Skip to content

Instantly share code, notes, and snippets.

@qoobaa
Created August 8, 2008 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qoobaa/4587 to your computer and use it in GitHub Desktop.
Save qoobaa/4587 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment