===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();