Development/Tutorials/Qt4 Ruby Tutorial/Chapter 04
Appearance
Development/Tutorials/Qt4 Ruby Tutorial/Chapter 4
Languages: عربي | Asturianu | Català | Česky | Kaszëbsczi | Dansk | Deutsch | English | Esperanto | Español | Eesti | فارسی | Suomi | Français | Galego | Italiano | 日本語 | 한국어 | Norwegian | Polski | Português Brasileiro | Română | Русский | Svenska | Slovenčina | Slovenščina | српски | Türkçe | Tiếng Việt | Українська | 简体中文 | 繁體中文
Let There Be Widgets
Tutorial Series | Qt4 Ruby Tutorial |
Previous | Tutorial 3 - Family Values |
What's Next | Tutorial 5 - Building Blocks |
Further Reading | n/a |
Let There Be Widgets

Files:
Overview
This example shows how to create your own widget, and describes how to control the minimum and maximum sizes of a widget.
require 'Qt4'
class MyWidget < Qt::Widget
def initialize(parent = nil)
super
setFixedSize(200, 120)
quit = Qt::PushButton.new(tr('Quit'), self)
quit.setGeometry(62, 40, 75, 30)
quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold))
connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
end
end
app = Qt::Application.new(ARGV)
widget = MyWidget.new()
widget.show()
app.exec()