敬告遊客:
以下內容枯燥無聊,若情非得已不建議進入。
若仍執意進入,當有頭暈嘔吐現象時請盡速離開本篇文章。




A modal dialog is a dialog that blocks input to other visible windows in the same application.
A modeless dialog is a dialog that operates independently of other windows in the same application.
當modal dialog在執行時,所有其他的視窗都會被block住,不儘無法收到msg也無法做任何的反應.


要讓dialog出現有兩種方法:exec() , show().
dialog.exec()==>modal dialog
dialog.show()==>modeless dialog
dialog.show();再搭配setModal也可設定為modal dialog 或 modeless dialog
dialog.show(); dialog.setModal(false);==>modeless dialog
dialog.show(); dialog.setModal(true);==>modal dialog


dialog.isModal() default value = false,要用dialog.show()讓dialog出現
所以當dialog.setModal(true)時, dialog.show()讓dialog出現時其他的window都被卡住了..

QWidget無setModal(bool)function,無exec()function
QDialog具有setModal(bool)和exec()function

當一QWidget設定為QDialog的屬性,再搭配上modal和show()也可做到modal dialog
QWidget->setWindowFlags ( Qt::Dialog );
QWidget->setWindowModality (Qt::ApplicationModal);
QWidget->show();



arrow
arrow
    文章標籤
    qt modal
    全站熱搜

    calories 發表在 痞客邦 留言(1) 人氣()