简体   繁体   中英

Qt QInputDialog parameter list

I am starting a Qt course this semester. Having looked at the official documentation as well as some on line examples I am confused by the parameter lists of the QInputDialog and QMessagebox classes.

Is there anywhere where one could find some decent info as to what to pass when creating the class / form?

Right now I have this by trial error

tempC = QInputDialog::getDouble(0, "Temperature Converter",
                                "Enter the temperature in Celsius to convert to Fahrenheit:", 1);

Looking at the official docs doesn't help a lot either (at least not for me yet) as it says this:

double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"),
                                   tr("Amount:"), 37.56, -10000, 10000, 2, &ok);

as an example.

Any links will be much appreciated.

double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"),
                                   tr("Amount:"), 37.56, -10000, 10000, 2, &ok);
  • A dialog will popup with parent the widget in which you are using this function. ( this )
  • The dialog's title will be QInputDialog::getDouble() ( tr is used in order to translate this string if you want using QtLinguist)
  • Inside the dialog will be a double spibox and a label
  • The label's string will be Amount:
  • The default value of the spinbox (what you see when the dialog popups) will be 37.56
  • The minimum value will be -10000 (you will not be able to set a value less than this)
  • The maximum value will be 10000 (you will not be able to set a value greater than this)
  • Two decimal point will be displayed, eg 3.478 will be displayed as 3.48.
  • If the user presses the Ok button then the ok argument will be set to true , otherwise it will be set to false

Check the documentation which includes an example for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM