en:code:examples
Show a custom dialog box
var window = new QDialog(); var layout = new QFormLayout(window); var nameLineEdit = new QLineEdit(window); var ageSpinBox = new QSpinBox(window); var buttonBox = new QDialogButtonBox(window); buttonBox.addButton(QDialogButtonBox.Ok); buttonBox.addButton(QDialogButtonBox.Cancel); buttonBox.accepted.connect(window.accept); buttonBox.rejected.connect(window.reject); layout.addRow("Name:", nameLineEdit); layout.addRow("Age:", ageSpinBox); layout.addRow(buttonBox); if(window.exec() == QDialog.Accepted) MessageBox().setText("Your name is " + nameLineEdit.text + "\nYou are " + ageSpinBox.value + " years old.").showModal();
en/code/examples.txt · Last modified: 2021/02/13 11:23 by 127.0.0.1