Read int from dialog : QInputDialog « Qt « C++






Read int from dialog

  

#include <QtGui>

int main (int argc, char* argv[]) {

    QApplication app(argc, argv);
    QTextStream cout(stdout, QIODevice::WriteOnly);

    int factArg = QInputDialog::getInteger(0, "Calculator","value:", 1);
    QString response = QString("The factorial of %1 is %2.\n%3").arg(factArg).arg(1);
    int answer = QMessageBox::question(0, "Play again?", response,QMessageBox::Yes | QMessageBox::No);
}

   
    
  








Related examples in the same category

1.QInputDialog: get integer
2.QInputDialog: get string item
3.QInputDialog: get text
4.Set value for QInputDialog