PDA

View Full Version : form closes after execution of slot



rahulvishwakarma
19th April 2020, 14:50
hi to all, I've centos7.5 and Qt 5.7 in VM. I am building a small project in this i shows a form in click on button of first form. On second form there is a "on_lineEditYesNo_returnPressed()" slot. this having following code :-


void dialogBill::on_lineEditYesNo_returnPressed()
{
QString ch;
QString yn1 = "y";
QString yn2 = "n";
ch = ui->lineEditYesNo->text().toUpper().trimmed();

if( (QString::compare(ch, yn1, Qt::CaseInsensitive)) == 0 )
{
ui->lineEditEnterMembershipNumber->setDisabled(false);
ui->lineEditEnterCardNumber->setDisabled(false);
ui->lineEditYesNo->setText("");
ui->pushButtonReturnToMenu->setVisible(true);
ui->pushButtonReturnToMenu->setEnabled(true);
}
else if( (QString::compare(ch, yn2, Qt::CaseInsensitive)) == 0)
{
ui->lineEditYesNo->setText("");
ui->pushButtonReturnToMenu->setEnabled(false);
parentWidget()->show();
}
}


problem is that after execution of this slot ( reaching at end ) this second form automatically closes. I don't want to do this.
please have any suggestion.