Created
August 8, 2008 17:03
-
-
Save qoobaa/4587 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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