Re: problem in Qt4 dialog
oftop: you don't need to call QDialog::show, because then you call QDialog::exec. btw, you don't free memory of you dialog. it would be better if you create that dialog in a stack, like this
Code:
void Disp:penDatumForm()
{
DatumForm datumform(this);
datumform.move(35, 90);
if(datumform.
exec() == QDialog::Accepted) { DatumVal = Datumno_Val;
XVal = Xdatum_Val;
YVal = Ydatum_Val;
ZVal = Zdatum_Val;
datuminitial();
}
}
ps. could you attach minimal compilable example which reproduces the problem?
4 Attachment(s)
Re: problem in Qt4 dialog
Thanks for the reply,
i tried with your code but i same problem till now i was using Qt-3.3 and i have done the applications using Qt-3.3 now i have migrated to Qt-4.2
I have attached the .cpp and .h file of the applications you can go through it and let me know where i am going wrong.
Re: problem in Qt4 dialog
ok, the problem is in Disp:: openDatumForm in this line
Code:
...
if(datumform.
exec() == QDialog::Accepted) ...
when you close this dialog by Alt+F4 then the result of exec will be QDialog::Rejected and you pass this block
Code:
{
DatumVal = Datumno_Val;
XVal = Xdatum_Val;
YVal = Ydatum_Val;
ZVal = Zdatum_Val;
datuminitial();
}
there is two ways:
add a "OK" button in that dialog and connect signal QPushButton::clicked with QDialog::accept and leave this code unchanged
Code:
void Disp::openDatumForm()
{
DatumForm datumform(this);
datumform.move(35, 90);
if(datumform.
exec() == QDialog::Accepted) { DatumVal = Datumno_Val;
XVal = Xdatum_Val;
YVal = Ydatum_Val;
ZVal = Zdatum_Val;
datuminitial();
}
}
the second ways is: to use code like this
Code:
void Disp::openDatumForm()
{
DatumForm datumform(this);
datumform.move(35, 90);
datumform.exec();
DatumVal = Datumno_Val;
XVal = Xdatum_Val;
YVal = Ydatum_Val;
ZVal = Zdatum_Val;
datuminitial();
}
in this case there is no need to add extra button in the dialog, but you also lose checking of the dialog acception or rejection.
Re: problem in Qt4 dialog
I tried with both the ways but i am not able to display the values in the Disp form same problem. During the start of the applications the lineEdits sholud display 0.000 and that is not happening here is start up code snippet..
Code:
{
setupUi(this);
qDebug( "Init Function ( During StartUp)" );
xlineEdit->setText("0.000");
ylineEdit->setText("0.000");
zlineEdit->setText("0.000");
decimals_mm = 3;
decimals_inch = 4;
datuminitial();
}
Please see my code attached and help us.
Re: problem in Qt4 dialog
I don't understand what you need...
Re: problem in Qt4 dialog
When i run my application all the lineEdits in Disp Form should display 0.000 this is done by
Code:
xlineEdit->setText("0.000");
ylineEdit->setText("0.000");
zlineEdit->setText("0.000");
but when i run the application it is displaying bank in all the lineEdits.