對話方塊分為模態和非模態;
1、模態對話方塊就是在其沒有被關閉之前,使用者不能與同乙個應用程式的其他視窗進行互動,直到該對話方塊關閉。
this->setmodal(true);
2、非模態對話方塊,當被開啟時,使用者既可選擇和該對話方塊進行互動,也可以選擇同應用程式的其他窗**互。
this->setmodal(false);
常見對話方塊
qcolor color = qcolordialog::getcolor(qt::red,this,tr("顏色對話方塊"));
qstring filename = qfiledialog::getopenfilename(this,tr("檔案對話方塊"),".",tr("c++檔案(*.cpp *.h)"));
//字型對話方塊
bool ok;
qfont font = qfontdialog::getfont(&ok,this);
if(ok)
ui->pushbutton_3->setfont(font);
else
qdebug()errordlg->showmessage(tr("這裡出錯!!!"));
//嚮導資訊對話方塊
qwizardpage *mywidget::ceatepage1()
qwizardpage *mywidget::ceatepage2()
qwizardpage *mywidget::ceatepage3()
///
Qt 對話方塊
1.qt 中使用qdialog 類實現對話方塊。就像主視窗一樣,我們通常會設計乙個類繼承 qdialog qdialog 及其子類,以及所有 qt dialog 型別的類 的對於其 parent 指標都有額外的解釋 如果 parent 為null 則該對話方塊會作為乙個頂層視窗,否則則作為其父元件的...
Qt 對話方塊
1.qdialog 類是對話方塊視窗的基類。對話方塊視窗是乙個頂級視窗,通常用作短期任務,或 者是與使用者的簡短會話等場合。2.對話方塊可以分為模態對話方塊和非模態對話方塊。所謂模態對話方塊就是在其沒有被關閉之前,使用者不能與同乙個應用程式的其他視窗進行互動,直到該對話方塊關閉。奪取焦點 對於非模態...
Qt之標準對話方塊 顏色對話方塊
1 在標頭檔案中包含 include qcolordialog void widget on colorbutton clicked 這裡使用了qcolordialog的靜態函式getcolor 來獲取顏色,它的三個引數的作用分別是 設定初始顏色 指定父視窗和設定對話方塊標題。getcolor 函式...