#!/usr/local/bin/ruby
require "qt2"
include Qt2

class Form1 < QDialog
def initialize(parent=nil,name="",modal=false,f=0)
   setName("Form1")
   resize( 356,161)
   setCaption(tr("Form1"))

   rgridlayout_5 = QGridLayout.new(self)
   rgridlayout_5.setMargin(11)
   rgridlayout_5.setSpacing(6)

   @PushButton1 = QPushButton.new(self)
   @PushButton1.setName("PushButton1")
   @PushButton1.setText(tr("OK"))
   @PushButton1.setDefault(true)
   rgridlayout_5.addMultiCellWidget(@PushButton1,3,4,1,1)

   @Spacer1_0 = QSpacerItem.new( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )
   rgridlayout_5.addMultiCell(@Spacer1_0,3,4,1,1)

   @Spacer3_1 = QSpacerItem.new( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )
   rgridlayout_5.addMultiCell(@Spacer3_1,3,4,1,1)

   @PushButton2 = QPushButton.new(self)
   @PushButton2.setName("PushButton2")
   @PushButton2.setText(tr("Cancel"))
   rgridlayout_5.addMultiCellWidget(@PushButton2,3,4,3,3)

   @Spacer2_2 = QSpacerItem.new( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )
   rgridlayout_5.addMultiCell(@Spacer2_2,3,4,3,3)

   @Slider1 = QSlider.new(self)
   @Slider1.setName("Slider1")
   @Slider1.setOrientation(Qt::Vertical)
   rgridlayout_5.addMultiCellWidget(@Slider1,0,2,6,6)

   @Dial1 = QDial.new(self)
   @Dial1.setName("Dial1")
   @Dial1.setMaximumSize(48,32767)
   rgridlayout_5.addWidget(@Dial1,1,5)

   @LCDNumber1 = QLCDNumber.new(self)
   @LCDNumber1.setName("LCDNumber1")
   rgridlayout_5.addMultiCellWidget(@LCDNumber1,0,2,0,4)

   @Spacer5_3 = QSpacerItem.new( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )
   rgridlayout_5.addMultiCell(@Spacer5_3,0,2,0,4)

   @Spacer4_4 = QSpacerItem.new( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )
   rgridlayout_5.addMultiCell(@Spacer4_4,0,2,0,4)

#connections of main form
   
   Qt2::connect(@PushButton1, QSIGNAL("clicked()"), self, QSLOT("accept()"))   
   Qt2::connect(@PushButton2, QSIGNAL("clicked()"), self, QSLOT("reject()"))   
   Qt2::connect(@Dial1, QSIGNAL("valueChanged(int)"), @Slider1, QSLOT("setValue(int)"))   
   Qt2::connect(@Slider1, QSIGNAL("valueChanged(int)"), @LCDNumber1, QSLOT("display(int)"))   
   Qt2::connect(@Slider1, QSIGNAL("valueChanged(int)"), @Dial1, QSLOT("setValue(int)"))

#taborders
end

end
#main roop for displaying form

a = QApplication.new([$0]+ARGV)
codec = QTextCodec.codecForName('UTF-8')
a.setDefaultCodec(codec)
#for close to quit program
Qt2::connect(QApplication::qApp,QSIGNAL("lastWindowClosed()"),
   QApplication::qApp,QSLOT("quit()"))
myform = Form1.new
a.setMainWidget(myform)
myform.show()
a.exec
