Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Form < Qt::Widget
- # Define slots of our class. Parenthesis are REQUIRED.
- slots 'showMessage()'
- def initialize(parent = nil)
- # Call the parent class constructor and pass the arguments to
- # it (equivalent to super(parent) call).
- super
- @ui = Ui_Form.new
- # Create our layout on this window.
- @ui.setupUi(self)
- # Connect 'clicked()' signal of push button with the
- # 'showMessage()' slot in this window.
- Qt::Object.connect(@ui.pushButton,
- SIGNAL('clicked()'),
- self,
- SLOT('showMessage()'))
- end
- def showMessage
- # Get the text from line edit widget.
- text = @ui.lineEdit.text
- # Show it in message box.
- Qt::MessageBox::information(self, 'Tutorial', text)
- end
- end
Add Comment
Please, Sign In to add comment