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

class QApplication
def initialize arg
   @firsttime = true
   @timer = startTimer(100)
   catchEvent
end
def timerEvent(e)
        Thread.pass
end
end



a = QApplication.new([$0]+ARGV)
codec = QTextCodec::codecForName("eucJP")
a.setDefaultCodec(codec)

th = Thread.start {
   a.exec()
}
print "Please enter command. \"quit\" for quit program.\n","ex) w = QWidget.new(); w.show\n"

line = ""
while(line != "quit")
   if(line != "")
      begin
         print eval(line),"\n"
      rescue Exception=>e
         print "Error:#{e.message}\n"
      end
   end
   print "iqt>"
   STDOUT.flush
   line = gets.chop
end

