Class: MetaBuilder::Qt4MB::FileInputWidget
- Inherits:
-
Qt::Widget
- Object
- Qt::Widget
- MetaBuilder::Qt4MB::FileInputWidget
- Defined in:
- lib/MetaBuilder/Qt4/Parameters/strings.rb
Overview
A widget with a nice Browse box to choose
Instance Method Summary collapse
- #button_clicked ⇒ Object
-
#initialize(parent, type) ⇒ FileInputWidget
constructor
Creates a Generic widget.
- #text ⇒ Object
- #text=(t) ⇒ Object
- #value ⇒ Object
- #value=(v) ⇒ Object
Constructor Details
#initialize(parent, type) ⇒ FileInputWidget
Creates a Generic widget. type is the FileParameter instance for whom we should do conversion.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 62 def initialize(parent, type) super(parent) @type = type @layout = Qt::HBoxLayout.new(self) @line_edit = Qt::LineEdit.new @layout.(@line_edit) connect(@line_edit, SIGNAL('editingFinished()'), SIGNAL('value_changed()')) @button = Qt::PushButton.new("Browse") @layout.(@button) connect(@button, SIGNAL('clicked()'), SLOT('button_clicked()')) end |
Instance Method Details
#button_clicked ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 78 def file = @type.qt4_get(parent, "dummy", "Select file", text) self.text=file rescue # Nothing, just don't set the current value end |
#text ⇒ Object
86 87 88 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 86 def text return @line_edit.text end |
#text=(t) ⇒ Object
90 91 92 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 90 def text=(t) @line_edit.setText(t) end |
#value ⇒ Object
95 96 97 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 95 def value return text end |
#value=(v) ⇒ Object
99 100 101 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 99 def value=(v) self.text=v end |