Non Qt application, wants a modal Qt dialog. Is this possible?
I had a windows application (non Qt), and I integrated Qt some years later, and now, I have a Qt dialog which I would like to be modal for the whole application.
Is this possible?
I have a class which derives QDialog. I tried both:
setModal( true ); in its constructor, and:
setWindowModality( Qt::ApplicationModal ); both in its constructor and from the place that I call it.
I call it like:
BrowseDialog dlg(...);
int result = dlg.exec();
I don't pass him any parent.
Is it possible to have that dialog modal for the whole application?
Re: Non Qt application, wants a modal Qt dialog. Is this possible?
Any answers?
I passed parent(HWND of MFC View) to the dialog, however, it is still not modal.:confused::confused:
Re: Non Qt application, wants a modal Qt dialog. Is this possible?
don't call exec(). use "show()" instead...
Re: Non Qt application, wants a modal Qt dialog. Is this possible?
Quote:
Originally Posted by
cuiqimeng
Any answers?
I passed parent(HWND of MFC View) to the dialog, however, it is still not modal.:confused::confused:
Since a QObject parant is a QObject* and you were giving it a number with meaning only to Windows it is hardly surprising that it doesn't work. It is surprising that it compiled.
I assume that the main application is still a non-Qt application and is therefore not connected with the Qt event loop. There is a some information on how to migrate MFC to Qt http://doc.qt.nokia.com/solutions/4/qtwinmigrate
There is also a defunct Qt Solution to assist with this integration. The source is: http://qt.gitorious.org/qt-solutions...r/qtwinmigrate
Quote:
Originally Posted by
FelixB
don't call exec(). use "show()" instead...
This will, by default, give a non-modal QDialog.