I don't understand why you succeed to display a QMessageBox but not a QDialog. Here's a simple example:
QWinWidget ww(adsw_acadMainWnd()); MyDialog dlg(&ww); ww.showCentered(); dlg.exec();
Over time, I noticed that problems could appear at the objects deletion (due to QObject architecture, i.e. parent-child), so I recommand to use pointer and call delete in the right place and time.
Note: If you want to put Qt in palettes, use a QWinWidget too.
Regards,
Thank you very much, I think my problem came from the line dlg.exec(); I didn't know on which instance to call exec().
Where do you instantiate the QApplication? in the DllMain ? Do you call exec() on it or only on the QDialog ?
Regards
I chose to initialize QApplication in On_kInitAppMsg and to destroy it (quit) in On_kUnloadAppMsg.
I use Qt for years, and it seems this is a good solution.
Regards,
Hi maisoui,
I followed your guides, qtwinmigrate and applied to ObjectARX 2015.
Succeeded to build ObjectARX MFC sample, "dynamic_dg", today.
But as you said, I encountered Runtime Error message, "...QWidget Must construct a QApplication before a QWidget".
Can you help me snippet code about QApplication?
Is it right place below initApp() or where?
Thanks in advance.
---------------
extern "C" AcRx::AppRetCode acrxEntryPoint( AcRx::AppMsgCode msg, void* pkt)
{
switch( msg )
{
case AcRx::kInitAppMsg:
acrxUnlockApplication(pkt);
acrxRegisterAppMDIAware(pkt);
initApp();
break;
case AcRx::kUnloadAppMsg:
unloadApp();
break;
default:
break;
}
return AcRx::kRetOK;
}
Hi,
Yes, in your initApp you need to allocate a QApplication. You can use QtWinMigrate to create a QMfcApplication or do by yourself :
int argc = 0; (void)new QApplication(argc, NULL);
From my my experience, I can say:
Don't forget to delete your QApplication in your "unload app".
Regards,
Thank you, Jonathan.
Another question I have.
After QApplication added to initApp(), I could not solve error, Qt's Windows Platform loading error, like attachements capture.
"This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: minimal, offscreen, windows.
Reinstalling the application may fix this problem."
I know about the message, so I did copy them all to my arx folder(--; and autocad folder)
(C:\Qt\5.2.1\msvc2012_64\plugins\platforms\*.dll)
Jonathan, you could save me. Thanks a lot.
Yes, you're right. For each OS Qt5 needs to load a specific plugin. For Windows, it's qwindow[d].dll. It's like other Qt plugins, subfolders must be in an accessible path. When you debug, you can simply use : PATH="$(QTDIR)\bin;$(PATH)" (if you have Qt VS addin installed).
Regards,
Hi, Jonathan ...
I tested basic Qt(5.2.1_x64) Loading on AutoCAD 2015 Platform until now, and succeeded following QMessageBox, very infant code.^^
Thanks for your helps. I'll develop this to next step application using QWinWidget as you said.
Regards,
Myeong Hwan, Kim
dynamic.arx => AutoCAD MFC Sample
icudt51.dll
icuin51.dll
icuuc51.dll
libEGL.dll
libGLESv2.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
qwindows.dll => plugins/platform for windows
_putenv("QT_QPA_PLATFORM_PLUGIN_PATH=C:/temp"); // Environmental variable 1... _putenv("PATH=C:/temp;%PATH%"); // Environmental variable 2... int argc = 0; (void)new QApplication(argc, NULL); //qApp->processEvents(); //QMessageBox::critical(0, QObject::tr("Test"), QObject::tr("Critical Messages...")); // OK! //QMessageBox::about(&win, "About QtMfc", "QtMFC Version 1.0\nCopyright (C) 2014"); // window handle? QMessageBox::about(0, "About QtMfc", "QtMFC Version 1.0\nCopyright (C) 2014"); //OK!