Hello,
I am actually starting a QMainWindow from a non-QT application via it's plugins system (Photoshop). The code which starts the QMainWindow is like follows:
// Initialize the QT engine.
int iArgC = 0;
CWndMainImpl cMainWin((HWND)((PlatformData*)gFilterRecord->platformData)->hwnd);
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
cMainWin.show();
app.exec();
// Initialize the QT engine.
int iArgC = 0;
static QApplication app (iArgC, NULL);
CWndMainImpl cMainWin((HWND)((PlatformData*)gFilterRecord->platformData)->hwnd);
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
cMainWin.show();
app.exec();
To copy to clipboard, switch view to plain text mode
I am doing a static QApplication, because the QT plugin can be started severals times without Photoshop restarts (E.g.: If the user wants to process different pictures).
[EDIT:] (HWND)((PlatformData*)gFilterRecord->platformData)->hwnd is a pointer to the main Photoshop's window handle.
Then when the user clicks on some of the CWndMainImpl buttons, i do like this:
setEnabled(false);
CDlgSettingsImpl cSettings(this);
if (cSettings.exec())
close();
setEnabled(true);
setEnabled(false);
CDlgSettingsImpl cSettings(this);
if (cSettings.exec())
close();
setEnabled(true);
To copy to clipboard, switch view to plain text mode
This displays a QDialog subclassed object.
My problem is, when the QDialog opens, the CPU goes to 100% (Actually, the 1st virtual proc of my hyper-threaded system goes to 50%)...
What am i doing wrong here? oO
Another thing (With or without it, the CPU problem is there, it's another question), after the CDlgSettingsImpl is started (And from it's constructor), i call another QMainWindow like this:
CDlgPreviewImpl* pPreview = new CDlgPreviewImpl(this);
pPreview->show();
CDlgPreviewImpl* pPreview = new CDlgPreviewImpl(this);
pPreview->show();
To copy to clipboard, switch view to plain text mode
What i want, is another window to be present at the same time when CDlgSettingsImpl is started (The window will hold the preview of the processed picture), but i dont want a "blocking" QDialog since it requires real-time communication with the caller object (CDlgSettingsImpl). Is my method the good one to do what i described?
Thanks a lot for your advices.
Pierre.
Bookmarks