Sha256: dacf5f8f999b08608c1d10cdfe72c39bfe058bd16b050df11bf381a449269b64

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby
$VERBOSE = true; $:.unshift File.dirname($0)

require 'Qt'
require_relative 'lcdrange.rb'
require_relative 'cannon.rb'

class MyWidget < Qt::Widget
  def initialize(parent = nil)
    super
    quit = Qt::PushButton.new('Quit')
    quit.font = Qt::Font.new('Times', 18, Qt::Font::Bold)

    connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))

    angle = LCDRange.new(self)
    angle.range = 5..70

    cannonField = CannonField.new(self)

    connect(angle, SIGNAL('valueChanged(int)'),
            cannonField, SLOT('setAngle(int)'))
    connect(cannonField, SIGNAL('angleChanged(int)'),
            angle, SLOT('setValue(int)'))
    gridLayout = Qt::GridLayout.new

    gridLayout.addWidget(quit, 0, 0)
    gridLayout.addWidget(angle, 1, 0)
    gridLayout.addWidget(cannonField, 1, 1, 2, 1)
    gridLayout.setColumnStretch(1, 10)
    setLayout(gridLayout)

    angle.setValue(60)
    angle.setFocus()
  end
end

a = Qt::Application.new(ARGV)

w = MyWidget.new
w.setGeometry(100, 100, 500, 355)
w.show
a.exec

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rock-qtbindings-4.8.6.5 examples/tutorial/t9/t9.rb
qtbindings-4.8.6.5 examples/tutorial/t9/t9.rb
qtbindings-4.8.6.5-x86-mingw32 examples/tutorial/t9/t9.rb
qtbindings-4.8.6.5-x64-mingw32 examples/tutorial/t9/t9.rb
qtbindings-4.8.6.4-x86-mingw32 examples/tutorial/t9/t9.rb
qtbindings-4.8.6.4-x64-mingw32 examples/tutorial/t9/t9.rb
qtbindings-4.8.6.4 examples/tutorial/t9/t9.rb