I'm trying to create a simple application, written in Ruby via Qt. I designed a form (MainForm) in a Qt Designer and translated it via rbuic4
to the Ruby code representation. The pure untouched result has four methods, and looks like this:
=begin
** Form generated from reading ui file 'stackover.ui'
**
** Created: Р’С‚ 24. РЅРѕСЏ 21:15:02 2009
** by: Qt User Interface Compiler version 4.3.1
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
=end
class Ui_MainWindow
attr_reader :centralwidget
attr_reader :pushButton
attr_reader :listView
attr_reader :menubar
attr_reader :statusbar
def setupUi(mainWindow)
mainWindow.setObjectName("mainWindow")
@centralwidget = Qt::Widget.new(mainWindow)
@centralwidget.setObjectName("centralwidget")
@pushButton = Qt::PushButton.new(@centralwidget)
@pushButton.setObjectName("pushButton")
@pushButton.setGeometry(Qt::Rect.new(10, 10, 75, 23))
@listView = Qt::ListView.new(@centralwidget)
@listView.setObjectName("listView")
@listView.setGeometry(Qt::Rect.new(10, 40, 431, 192))
mainWindow.setCentralWidget(@centralwidget)
@menubar = Qt::MenuBar.new(mainWindow)
@menubar.setObjectName("menubar")
@menubar.setGeometry(Qt::Rect.new(0, 0, 451, 21))
mainWindow.setMenuBar(@menubar)
@statusbar = Qt::StatusBar.new(mainWindow)
@statusbar.setObjectName("statusbar")
mainWindow.setStatusBar(@statusbar)
retranslateUi(mainWindow)
size = Qt::Size.new(451, 276)
size = size.expandedTo(mainWindow.minimumSizeHint())
mainWindow.resize(size)
Qt::MetaObject.connectSlotsByName(mainWindow)
end # setupUi
def setup_ui(mainWindow)
setupUi(mainWindow)
end
def retranslateUi(mainWindow)
mainWindow.setWindowTitle(Qt::Application.translate("MainWindow", "MainWindow", nil, Qt::Application::UnicodeUTF8))
@pushButton.setText(Qt::Application.translate("MainWindow", "PushButton", nil, Qt::Application::UnicodeUTF8))
end # retranslateUi
def retranslate_ui(mainWindow)
retranslateUi(mainWindow)
end
end
module Ui
class MainWindow < Ui_MainWindow
end
end # module Ui
The major idea is to create a Ruby-Qt application, to run my small Ruby apps with GUI - as for now I don't need all the power of Qt library.
I'm aware of this great example, but it shows off a different generated code for the .ui file. Or did they managed to alter it somehow? Anyway, their example works fine, while I can't make my own working properly.
I just don't know what to do with my generated file, how to go further and make a connection with my Ruby program... Maybe my rbuic4
is wrong? Or am I'm running it with incorrect options (I'm an -o
option) to get the arachnoid-like template?