Sha256: 54277dbcf243150a26a1e866d6fc6de1ebaff5c219bc226254d6974a2e7cc0c7

Contents?: true

Size: 481 Bytes

Versions: 11

Compression:

Stored size: 481 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

11 entries across 11 versions & 1 rubygems

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