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:
Qt Code:
  1. static QtModelviewer* gModelViewer = 0;
  2.  
  3. MODELVIEWER_C_EXPORT int OpenModelViewer( const LaunchParams& launchParams )
  4. {
  5. int retVal = -1;
  6. if( QMfcApp::pluginInstance( launchParams.hInstance ) )
  7. {
  8. QWinWidget win( launchParams.hWndParent );
  9. gModelViewer = new QtModelviewer( &win );
  10. if( gModelViewer->loadModel( launchParams.filePath ) )
  11. {
  12. gModelViewer->show();
  13. retVal = qApp->exec();
  14. }
  15. delete qApp;
  16. gModelViewer = 0;
  17. }
  18. return retVal;
  19. }
  20.  
  21. MODELVIEWER_C_EXPORT bool CloseModelViewer( )
  22. {
  23. if( gModelViewer )
  24. {
  25. qApp->quit();
  26. return true;
  27. }
  28. return false;
  29. }
To copy to clipboard, switch view to plain text mode 
I've tried several things including 'How can I embed e.g a QMainWindow inside a QDialog ?' to no avail.