Sha256: de35f1bea1c8c73fbe4d21f81862a1e945ca38f5d464307997614f24535442ec

Contents?: true

Size: 462 Bytes

Versions: 7

Compression:

Stored size: 462 Bytes

Contents

#!/usr/bin/ruby -W
require "Qt"

app = Qt::Application.new(ARGV)

hello = Qt::PushButton.new('Hello World!')
hello.resize(100, 30)
hello.show()

# This code hangs the application because it is trying to access the GUI
# (QT code) outside of the main thread
#Thread.new { sleep 2; hello.resize(200,50) }

# This code executes because it puts the GUI code inside
# Qt.execute_in_main_thread
Qt.execute_in_main_thread { sleep 2; hello.resize(200,50) }

app.exec()

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rock-qtbindings-4.8.6.5 examples/threading/main_thread.rb
qtbindings-4.8.6.5 examples/threading/main_thread.rb
qtbindings-4.8.6.4 examples/threading/main_thread.rb
qtbindings-4.8.6.2 examples/threading/main_thread.rb
qtbindings-4.8.6.1 examples/threading/main_thread.rb
qtbindings-4.8.6.0 examples/threading/main_thread.rb
qtbindings-4.8.6.0-x86-mingw32 examples/threading/main_thread.rb