Hey peeps,
Has anyone successfully used QMainWindow and QWinWidget together without issue?
I get problems with focus and activating the QMainWindow.
For example, sometimes a double click is needed, other times one click is needed, and other times (more often that not) I can't click on the window at all without clicking outside of the MFC app then clicking back on the QMainWindow. It appears parenting / ownership isn't quite right.
Here's the current code setup:
I've tried several things including 'How can I embed e.g a QMainWindow inside a QDialog ?' to no avail.Qt Code:
static QtModelviewer* gModelViewer = 0; MODELVIEWER_C_EXPORT int OpenModelViewer( const LaunchParams& launchParams ) { int retVal = -1; if( QMfcApp::pluginInstance( launchParams.hInstance ) ) { QWinWidget win( launchParams.hWndParent ); gModelViewer = new QtModelviewer( &win ); if( gModelViewer->loadModel( launchParams.filePath ) ) { gModelViewer->show(); retVal = qApp->exec(); } delete qApp; gModelViewer = 0; } return retVal; } MODELVIEWER_C_EXPORT bool CloseModelViewer( ) { if( gModelViewer ) { qApp->quit(); return true; } return false; }To copy to clipboard, switch view to plain text mode
Bookmarks