1
votes

I would like to know what happens when I call QWidget-close() I called it after a setup function I coded and this disabled some of my slots to get called.

before(creates odd behavior):
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)));

myFPS->getData(REQUEST_SYSTEM_CONFIGURATION);
int numTxChains=myFPS->SystemData.NumberOfTransmitterChainsInSystem;
grpList.clear();
grpList.append("Select group");
for(int i=0;i<MAX_GROUPS;i++){
    myFPS->getData(REQUEST_GROUP_INFORMATION,i);
    grpCfgEleList.at(i)->ui.leGrpName->setText(myFPS->GroupData.Group[i].Name);
    grpList.append(myFPS->GroupData.Group[i].Name);
}
for(int i=0;i<numTxChains;i++){

    myFPS->getData(REQUEST_TX_CONFIGURATION,i);
    txNameList.at(i)->setVisible(true);
    txNameList.at(i)->setText(myFPS->TransmitterConfigurationData[i].Name);
    txGrpCBlist.at(i)->setVisible(true);
    txGrpCBlist.at(i)->clear();
    txGrpCBlist.at(i)->addItems(grpList);
    txGrpCBlist.at(i)->setCurrentIndex(myFPS->TransmitterConfigurationData[i].Group+INDEX_OFFSET);

}
for(int i=numTxChains;i<MAX_NUMBER_OF_TRANSMITTERS;i++){
    txNameList.at(i)->setVisible(false);
    txGrpCBlist.at(i)->setVisible(false);
}

for(int i=0;i<MAX_GROUPS;i++){
    updateGrpFailover(i, STAY,-1);
}
//need to wait till setup is complete to activate these signals (populating comboboxes overwrote UDP structs with false data)
connect(signalMapper, SIGNAL(mapped(int)), this, SIGNAL(txGrpComboBoxCurItemChanged(const int)));
connect(this, SIGNAL(txGrpComboBoxCurItemChanged(const int)),this,SLOT(updateTxFailOrderLayouts(int)));

}

3

3 Answers

2
votes

Try using QWidget::hide() instead of close().

1
votes

http://doc.trolltech.com/4.6/qwidget.html#close

It tells you exactly what it does. What type is pGrpCfg? That will tell you what the reimplemented version of the function is doing.

1
votes

The answer is: when I called QWidget->Close(), this destroys my signal connection. The signal connections are made in setupGrpConfig so to call close after setupGrpConfig voided the signal connections.