Qt学习笔记

来源:互联网 发布:如何导出淘宝数据包 编辑:程序博客网 时间:2024/06/03 21:23

Qt模态框

QDialog *dialog = new QDialog(&w);dialog->setModal(true);dialog->show();

生成的模态框可以线程阻断,setWindowModality()函数有一个参数来设置要阻塞的窗口类型。setWindowModality()函数默认值为Qt::Application,意思为阻塞除它以外的所有窗口。P64

Qt信号与槽

P65

// 在ui_xxx.h文件中showChildButton->setObjectName(QStringLiteral("showChildButton"));// 在头文件中public slots:    void showChildDialog();// 在xxx.cpp文件中QtTest::QtTest(QWidget *parent) : QMainWindow(parent){    ui.setupUi(this);    connect(ui.showChildButton, SIGNAL(clicked()), this, SLOT(showChildDialog()));}void QtTest::showChildDialog(){    QDialog *dialog = new QDialog(this);    dialog->setModal(true);    dialog->show();}
0 0
原创粉丝点击