Class: Cosmos::TextDialog
- Inherits:
-
Qt::Dialog
- Object
- Qt::Dialog
- Cosmos::TextDialog
- Defined in:
- lib/cosmos/tools/table_manager/table_manager.rb
Overview
A dialog box containing a text field and ok button
Instance Method Summary collapse
-
#initialize(parent) ⇒ TextDialog
constructor
A new instance of TextDialog.
-
#set_size(width, height) ⇒ Object
Set the size of the dialog box.
-
#set_title_and_text(title, text) ⇒ Object
Set the title of the dialog box and the text contents.
Methods inherited from Qt::Dialog
Constructor Details
#initialize(parent) ⇒ TextDialog
Returns a new instance of TextDialog.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/cosmos/tools/table_manager/table_manager.rb', line 92 def initialize(parent) super(parent) layout = Qt::VBoxLayout.new @text = Qt::PlainTextEdit.new if Kernel.is_windows? @text.setFont(Cosmos.getFont('courier', 10)) else @text.setFont(Cosmos.getFont('courier', 14)) end @text.setReadOnly(true) layout.addWidget(@text) = Qt::HBoxLayout.new = Qt::PushButton.new('OK') .connect(SIGNAL('clicked()')) { self.accept } .addStretch .addWidget() .addStretch layout.addLayout() setLayout(layout) end |
Instance Method Details
#set_size(width, height) ⇒ Object
Set the size of the dialog box
125 126 127 |
# File 'lib/cosmos/tools/table_manager/table_manager.rb', line 125 def set_size(width, height) resize(width, height) end |
#set_title_and_text(title, text) ⇒ Object
Set the title of the dialog box and the text contents
119 120 121 122 |
# File 'lib/cosmos/tools/table_manager/table_manager.rb', line 119 def set_title_and_text(title, text) self.setWindowTitle(title) @text.setPlainText(text) end |