I have a UI file, which is created in Qt Designer, which I call Its solution is to load MyApplicationObject.h and the implementation file here: MyApplicationObject.h Qualiloder on runtime < Code> class What is it possible to ask the states of all widgets in the dialogue when the dialog stops? I can exceed the widget hierarchy from the root widget, but I do not know how to trigger this traversal when this dialog stops.
QWidget to
QUiLoader There may be an event filter to install. In the
eventFilter mode, you can catch an event that is hidden (either by accepting or rejecting the slot, it can be triggered by the dialog). The header file for Explet will look like this:
#include & lt; QObject & gt; Class MyApplicationObject: Public QObject {Q_OBJECT Public: Clear MyApplicationObject (QObject * parent = 0); ~ MyApplicationObject () {} bool eventFilter (QObject * object, QEvent * event); Private: QWidget * m_dialog; };
#include & lt; QFile & gt; #include & lt; QtUiTools / QuiLoader & gt; Include # "MyApplicationObject.h" MyApplicationObject :: MyApplicationObject (QObject * parent): QObject (parent) {QuiLoader loader; QFile file (": / dialog / dialog 1"); File.open (QFile :: read-only); M_dialog = loader.load (and file); M_dialog- & gt; InstallEventFilter (this); File.close (); M_dialog- & gt; Show (); } Bool MyApplicationObject :: eventFilter (QObject * object, QEvent * event) {if (object == m_dialog) {if (event-> type () == QEvent :: Hide) {qDebug (something with "Dialog widget" Do dialogue was accepted or rejected "); Back true; } Other {return false; }} And {// call base implementation returns QMainWindow :: eventFilter (object, event); }}
No comments:
Post a Comment