我希望在我显示辅助表单时,主窗体会禁用itselft。
我知道我可以使用this->setEnabled = false;
,但我怎么知道二级表格什么时候关闭? (重新启用主表单)。
提前致谢。
答案 0 :(得分:1)
主要小部件
QChildWidget *child = new QChildWidget();
connect(child,SIGNAL(closed()),this,SLOT(childClosed())); //connect child signal to childClosed slot
child->show(); // show child
this->setEnabled(false); // disable main widget
.
.
.
public QMainWidget::childClosed() // implementation of childClosed slot
{
this->setEnabled(true);
}
child widget
#include <QCloseEvent>
public QChildWidget: public QWidget
{
.
.
.
protected:
void closeEvent() // it is called when widget is closed
{
emit closed();
}
signals:
void closed(); // closed signal
};