1
我正在開發一個使用ruby和qt作爲前端的應用程序。我使用qtdesigner來繪製gui並使用rbuic4轉換代碼。但我無法對主程序中的按鈕進行任何操作。我創建了main.rb並使用require'./muprogramm.rb'來調用生成的代碼。下面是打開文件對話框按鈕mbusb_close(對象名稱)的示例代碼Qtdesinger,ruby和生成代碼中的按鈕/小部件的一些操作
require './muprogramm.rb'
require 'Qt4'
class Form < Qt::Widget
slots 'file_dialog()'
def initialize(parent = nil)
super
@ui = Ui_Frame.new
@ui.setupUi(self)
Qt::Object.connect(@ui.mbusb_close, SIGNAL('clicked()'), self, SLOT('file_dialog()'))
end
def file_dialog
f = Qt::FileDialog
text = File.new(f.getOpenFileName).read
#@ui.editor_window.setText 'WikiBooks: Ruby'
end
end
a = Qt::Application.new(ARGV)
u = Ui_Frame.new
w = Qt::Frame.new
u.setupUi(w)
w.show
a.exec
淨可用資源是模糊的。任何幫助表示讚賞