#!/usr/local/bin/ruby
=begin
/****************************************************************
**
** Qt tutorial 6
**
****************************************************************/
=end

require "qt2"
include Qt2

class LCDRange  < QVBox

def initialize ( parent=0, name=0 )
    super ( parent, name )

     lcd  = QLCDNumber.new( 2, self, "lcd"  )
    slider = QSlider.new( Horizontal, self, "slider" )
    slider.setRange( 0, 99 )
    slider.setValue( 0 )
    connect( slider, QSIGNAL("valueChanged(int)"), lcd, "display(int)" )
end
end

class MyWidget  < QVBox

def initialize ( parent=0, name=0 )
    super ( parent, name )

    quit = QPushButton.new( "Quit", self, "quit" )
    quit.setFont( QFont.new( "Times", 18, QFont::Bold ) )

    connect( quit, QSIGNAL("clicked()"), QApplication::qApp, "quit()" )

    grid = QGrid.new( 4, self )

    for c in 0..3 #( int c = 0  c < 4  c++ )
	for r in 0.. 3 #( int r = 0  r < 4  r++ )
	    LCDRange.new( grid )
              end
    end
end
end

    a = QApplication.new( [$0]+ARGV )

    w = MyWidget.new
    a.setMainWidget( w )
    w.show()
    a.exec()

