我想知道当我调用QWidget-close()之后会发生什么事情我在我编码的设置函数之后调用了它,这会禁用我的一些插槽来调用它。
之前(创造奇怪的行为):
pGrpCfg->setupGrpConfig();
pGrpCfg->close();
pGrpCfg->show();
after(ok):
pGrpCfg->close();
pGrpCfg->setupGrpConfig();
pGrpCfg->show();
This is my function. The only thing I suspect could have an impact on it is the Signal connections(I would like to add that these connections start in the constructor where I use QSignalMapper):
void grpConfig::setupGrpConfig(){
disconnect(signalMapper, SIGNAL(mapped(int)), this, SIGNAL(txGrpComboBoxCurItemChanged(const int)));
disconnect(this, SIGNAL(txGrpComboBoxCurItemChanged(const int)),this,SLOT(updateTxFailOrderLayouts(int)));
pGrpCfg->close();
pGrpCfg->setupGrpConfig();
pGrpCfg->show();
}
答案 0 :(得分:2)
尝试使用QWidget::hide()
代替close()
。
答案 1 :(得分:1)
http://doc.trolltech.com/4.6/qwidget.html#close
它准确地告诉你它的作用。什么类型pGrpCfg
?
这将告诉你该函数的重新实现版本正在做什么。
答案 2 :(得分:1)
答案是:当我调用QWidget-> Close()时,这会破坏我的信号连接。信号连接在setupGrpConfig中进行,以便在setupGrpConfig取消信号连接后调用close。