Guest User

Untitled

a guest
Feb 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. class Form < Qt::Widget
  2. # Define slots of our class. Parenthesis are REQUIRED.
  3. slots 'showMessage()'
  4.  
  5. def initialize(parent = nil)
  6. # Call the parent class constructor and pass the arguments to
  7. # it (equivalent to super(parent) call).
  8. super
  9. @ui = Ui_Form.new
  10. # Create our layout on this window.
  11. @ui.setupUi(self)
  12. # Connect 'clicked()' signal of push button with the
  13. # 'showMessage()' slot in this window.
  14. Qt::Object.connect(@ui.pushButton,
  15. SIGNAL('clicked()'),
  16. self,
  17. SLOT('showMessage()'))
  18. end
  19.  
  20. def showMessage
  21. # Get the text from line edit widget.
  22. text = @ui.lineEdit.text
  23. # Show it in message box.
  24. Qt::MessageBox::information(self, 'Tutorial', text)
  25. end
  26. end
Add Comment
Please, Sign In to add comment