Qt ProgressDialog

Sorry for my english…Hello everyone I am here for to ask help.
I can not solve from myself.
In practice I would to run one method for start the instructions and see
the progressbar to progress,
I can do this with one thread as you can see from my code,
But I would like to avoid using in the thread because when I run
instructions
more complex as like win32ole open an excel file and copy data, the
performance are very slow, I tried to remove Instructions
from the thread but the window does not respond, and I update the
progressbar
at the end of processing, I would my application
respond also when he’s working on something, I have also tried
the trick:

timer=Qt::Timer.new(self)
timer.start(10)
connect(timer, SIGNAL(‘timeout()’), self, SLOT(‘update()’))

But not work for me.

Thank, best regard,

main.rb


require ‘Qt’
require ‘window.rb’

app = Qt::Application.new(ARGV)
win = Window.new
win.show
win.exec


windows.rb


class Window < Qt::Dialog

slots ‘update()’,‘run()’

def initialize(parent = nil)
super(parent)

@numberLabel = Qt::Label.new(tr("Number:"))
@numberLineEdit = Qt::LineEdit.new("Inser number")
@numberLabel.buddy = @numberLineEdit
@statusLabel = Qt::Label.new(tr("Please enter one number."))
@connectButton = Qt::PushButton.new(tr("Run"))
@connectButton.default = true
@quitButton = Qt::PushButton.new(tr("Quit"))
@progressDialog = Qt::ProgressDialog.new(self)

connect(@connectButton, SIGNAL(:clicked), self, SLOT('run()'))
connect(@quitButton, SIGNAL(:clicked), self, SLOT(:close))

topLayout = Qt::HBoxLayout.new do |t|
  t.addWidget(@numberLabel)
  t.addWidget(@numberLineEdit)
  t.addWidget(@connectButton)
end

buttonLayout = Qt::HBoxLayout.new do |b|
  b.addStretch(1)
  b.addWidget(@quitButton)
end

self.layout = Qt::VBoxLayout.new do |m|
  m.addLayout(topLayout)
  m.addWidget(@statusLabel)
  m.addLayout(buttonLayout)
end

setWindowTitle(tr("Calculator"))

end

def run()
Qt::Application.overrideCursor = Qt::Cursor.new(Qt::WaitCursor)
@statusLabel.text = tr(“Elaborazine in corso”)
@progressDialog.labelText = tr(“Elaborazione…”)
@progressDialog.show()
@connectButton.enabled = false

@i=0
Thread.new()do
while @i<100
  sleep 0.1
  @progressDialog.maximum = 100
  @progressDialog.value = @i
  @i=@i+1
end

end
end

end