diff options
Diffstat (limited to 'qtruby/rubylib/tutorial/t14/gamebrd.rb')
-rw-r--r-- | qtruby/rubylib/tutorial/t14/gamebrd.rb | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/qtruby/rubylib/tutorial/t14/gamebrd.rb b/qtruby/rubylib/tutorial/t14/gamebrd.rb index b72d58c1..4ae474c2 100644 --- a/qtruby/rubylib/tutorial/t14/gamebrd.rb +++ b/qtruby/rubylib/tutorial/t14/gamebrd.rb @@ -1,14 +1,14 @@ -require 'lcdrange.rb' -require 'cannon.rb' +retquire 'lcdrange.rb' +retquire 'cannon.rb' -class GameBoard < Qt::Widget +class GameBoard < TQt::Widget slots 'fire()', 'hit()', 'missed()', 'newGame()' def initialize() super - quit = Qt::PushButton.new('&Quit', self, 'quit') - quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold)) + quit = TQt::PushButton.new('&Quit', self, 'quit') + quit.setFont(TQt::Font.new('Times', 18, TQt::Font::Bold)) connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()')) @@ -18,8 +18,8 @@ class GameBoard < Qt::Widget force = LCDRange.new( 'FORCE', self, 'force' ) force.setRange( 10, 50 ) - box = Qt::VBox.new( self, 'cannonFrame' ) - box.setFrameStyle( Qt::Frame::WinPanel | Qt::Frame::Sunken ) + box = TQt::VBox.new( self, 'cannonFrame' ) + box.setFrameStyle( TQt::Frame::WinPanel | TQt::Frame::Sunken ) @cannonField = CannonField.new( box, 'cannonField' ) connect( angle, SIGNAL('valueChanged(int)'), @@ -37,42 +37,42 @@ class GameBoard < Qt::Widget connect( @cannonField, SIGNAL('missed()'), self, SLOT('missed()') ) - shoot = Qt::PushButton.new( '&Shoot', self, 'shoot' ) - shoot.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + shoot = TQt::PushButton.new( '&Shoot', self, 'shoot' ) + shoot.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( shoot, SIGNAL('clicked()'), SLOT('fire()') ) connect( @cannonField, SIGNAL('canShoot(bool)'), shoot, SLOT('setEnabled(bool)') ) - restart = Qt::PushButton.new( '&New Game', self, 'newgame' ) - restart.setFont( Qt::Font.new( 'Times', 18, Qt::Font::Bold ) ) + restart = TQt::PushButton.new( '&New Game', self, 'newgame' ) + restart.setFont( TQt::Font.new( 'Times', 18, TQt::Font::Bold ) ) connect( restart, SIGNAL('clicked()'), self, SLOT('newGame()') ) - @hits = Qt::LCDNumber.new( 2, self, 'hits' ) - @shotsLeft = Qt::LCDNumber.new( 2, self, 'shotsleft' ) - hitsL = Qt::Label.new( 'HITS', self, 'hitsLabel' ) - shotsLeftL = Qt::Label.new( 'SHOTS LEFT', self, 'shotsleftLabel' ) + @hits = TQt::LCDNumber.new( 2, self, 'hits' ) + @shotsLeft = TQt::LCDNumber.new( 2, self, 'shotsleft' ) + hitsL = TQt::Label.new( 'HITS', self, 'hitsLabel' ) + shotsLeftL = TQt::Label.new( 'SHOTS LEFT', self, 'shotsleftLabel' ) - accel = Qt::Accel.new( self ) - accel.connectItem( accel.insertItem( Qt::KeySequence.new(Key_Enter) ), + accel = TQt::Accel.new( self ) + accel.connectItem( accel.insertItem( TQt::KeySequence.new(Key_Enter) ), self, SLOT('fire()') ) - accel.connectItem( accel.insertItem( Qt::KeySequence.new(Key_Return) ), + accel.connectItem( accel.insertItem( TQt::KeySequence.new(Key_Return) ), self, SLOT('fire()') ) - accel.connectItem( accel.insertItem( Qt::KeySequence.new(CTRL+Key_Q) ), + accel.connectItem( accel.insertItem( TQt::KeySequence.new(CTRL+Key_Q) ), $qApp, SLOT('quit()') ) - grid = Qt::GridLayout.new( self, 2, 2, 10 ) + grid = TQt::GridLayout.new( self, 2, 2, 10 ) grid.addWidget( quit, 0, 0 ) grid.addWidget( box, 1, 1) grid.setColStretch( 1, 10 ) - leftBox = Qt::VBoxLayout.new() + leftBox = TQt::VBoxLayout.new() grid.addLayout( leftBox, 1, 0 ) leftBox.addWidget( angle ) leftBox.addWidget( force ) - topBox = Qt::HBoxLayout.new() + topBox = TQt::HBoxLayout.new() grid.addLayout( topBox, 0, 1 ) topBox.addWidget( shoot ) topBox.addWidget( @hits ) |