窗體部件效果之模態

2021-08-02 21:45:41 字數 1496 閱讀 2054

//對於qdialog

//modal, mothod 1 (shake effect)

qdialog dlg(this);

// dlg.setwindowflags(qt::framelesswindowhint);//設定這個屬性dialog顯示不出來

dlg.setwindowflags(qt::framelesswindowhint | qt::dialog);//只有同時設定這連個屬性才能正常顯示dialog

dlg.move(100,100);

dlg.resize(400,300);

qpushbutton *btn = new qpushbutton("click", &dlg);

btn->show();

connect(btn, signal(clicked(bool)), &dlg, slot(close()));

dlg.exec();

// //modal, mothod 2 (shake effect)

// qdialog *pdlg = new qdialog(this);

// pdlg->setmodal(true);

// pdlg->setwindowflags(qt::framelesswindowhint | qt::dialog);

// qpushbutton *btn = new qpushbutton("click", pdlg);

// btn->show();

// connect(btn, signal(clicked(bool)), pdlg, slot(close()));

// pdlg->show();

// pdlg->resize(400,300);//必須放在此處

// //modal, mothod 3 (no shake effect)

// qdialog *pdlg = new qdialog();

// pdlg->setmodal(true);

// pdlg->setwindowflags(qt::framelesswindowhint);

// pdlg->show();

// //nomodal, mothod 1

// qdialog *pdlg = new qdialog(this);

// pdlg->setwindowflags(qt::framelesswindowhint);

// pdlg->show();

//對於qwidget

// qwidget *pwgt = new qwidget();//此處不能指定父視窗this,只能是0(null)或無參;

//// pwgt->setattribute(qt::wa_showmodal, true);//also ok

// pwgt->show();

對話方塊,模態窗體

對話方塊窗體 1.alert hello world ok按鈕 2.confirm are you sure?ok按鈕,cancel按鈕 3.prompt what s your name?jerry 對話方塊 例 var sresult prompt what is your name?if sr...

靜態 動態呼叫dll封裝窗體 模態 非模態

看到有需要這樣的例子,所以寫了乙個.有不對或不合理的地方請跟帖指導.delph xe下測試通過.dll專案檔案 library project10 uses sysutils,classes,forms,unit14 in unit14.pas function edebtmoney h thand...

窗體漸變效果

using system.runtime.interopservices dllimport user32.dll private static extern bool animatewindow int hwnd,int dwtime,int dwflags private const int a...