Class: Cosmos::SelectDialog
- Defined in:
- lib/cosmos/gui/dialogs/select_dialog.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(parent, label_text, items, title = 'Select Item') ⇒ SelectDialog
constructor
A new instance of SelectDialog.
Constructor Details
#initialize(parent, label_text, items, title = 'Select Item') ⇒ SelectDialog
Returns a new instance of SelectDialog.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cosmos/gui/dialogs/select_dialog.rb', line 20 def initialize(parent, label_text, items, title = 'Select Item') @result = nil dialog = Qt::Dialog.new(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) dialog.setWindowTitle(title) dialog_layout = Qt::VBoxLayout.new chooser = ComboboxChooser.new(dialog, label_text, items) dialog_layout.addWidget(chooser) = Qt::HBoxLayout.new ok = Qt::PushButton.new("Ok") ok.connect(SIGNAL('clicked()')) do dialog.accept() end .addWidget(ok) cancel = Qt::PushButton.new("Cancel") cancel.connect(SIGNAL('clicked()')) do dialog.reject() end .addWidget(cancel) dialog_layout.addLayout() dialog.setLayout(dialog_layout) dialog.raise if dialog.exec == Qt::Dialog::Accepted @result = chooser.string else @result = nil end dialog.dispose end |
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
18 19 20 |
# File 'lib/cosmos/gui/dialogs/select_dialog.rb', line 18 def result @result end |