From: Carl Bourne Date: 2007-07-25T01:20:54+09:00 Subject: rubyQT Hi, I wonder if you can help. I'm currently exploring rubyqt in conjunction with the latest QT4 libraries. However, I can't seem to get a TextEdit widget to refresh properly. My code runs correctly when I click the button that has a ruby function assigned to it, but the TextEdit field does not update until the ruby function completes. Here's the code I'm using:- -------------------------------------------------------------------------------------------------- main.rb ---------- require 'Qt' require 'dialog.rb' app = Qt::Application.new(ARGV) dialog = Dialog.new dialog.exec ------ dialog.rb ------- class MyWidget < Qt::Widget slots 'go()' def initialize(parent = nil) super(parent) setFixedSize(500, 500) @textedit = Qt::TextEdit.new(self) @textedit.setGeometry(5, 50, 480, 300) quit = Qt::PushButton.new(('Generate'), self) quit.setGeometry(5, 5, 100, 30) quit.setFont(Qt::Font.new('Arial', 12, Qt::Font::Bold)) connect(quit, SIGNAL(:clicked)) {@textedit.clear(); go() } end def go # @textedit.clear() @textedit.setText("Generating files:-") count = 0 50.times do count+=1 sleep 0.1 @textedit.append("Generating file: "+count.to_s) puts "hello" end @textedit.append("Done") end end app = Qt::Application.new(ARGV) widget = MyWidget.new() widget.show() app.exec() ------------------------------------------------------------------------------------------------- -- Posted via http://www.ruby-forum.com/.