开发者

Qt4 Designer and Ruby, what am I doing wrong?

So I've been trying to make ruby read my Qt4 design and it's not working, at all. I've created a design in Qt4 Designer and saved it as a .ui file. Then I used rbuic4 to convert it to a design_ui.rb and Qt4. My current ruby main file looks like this:

require 'gui/design_ui.rb'
require 'Qt4'

class AppMain < Ui_MainWindow
 def initialize(app)
  @app = ap开发者_JAVA百科p
 end
end

# create and show dialog
if $0 == __FILE__
   app = Qt::Application.new(ARGV)
   dialog = AppMain.new(app)
   dialog.show
   app.exec
end

I Seriously can't find a decent guide to properly using ruby and Qt4 Designer. They all do different stuff and none of them works. Please help a newbie out here?


Something like this:

class AppMain < Qt::MainWindow
    def initialize(parent = nil)
        super
        @ui = Ui_Main_window.new
        @ui.setupUi self
    end
end

Then

application = Qt::Application.new(ARGV)
main_window = AppMain.new
main_window.show
application.exec
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜