PDA

View Full Version : Input Dialog



Enoctaffie
13th February 2012, 10:08
Hi All. Please assit. Learning programming and I want to use an input dialog box first without the Cancel push button and then later make use of the cancel push button to end the program. I am using the following statement for the input dialog QInputDialog::getInteger(0, "Calculator", "Calculated value", 1, 1, 10,1,0,0)

Spitfire
15th February 2012, 13:25
QInputDialog::getInteger is obsolete, use getInt() instead.


// example
bool ok;
int i = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"), tr("Percentage:"), 25, 0, 100, 1, &ok);
if(!ok)
{
exit( 0 );
}

If ok is nonnull *ok will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is parent.