class DigitalClock
Public Class Methods
new(parent = nil)
click to toggle source
Constructs a DigitalClock widget
Calls superclass method
# File examples/widgets/digitalclock/digitalclock.rb, line 8 def initialize(parent = nil) super(parent) setSegmentStyle(Filled) @timer = Qt::Timer.new(self) connect(@timer, SIGNAL('timeout()'), self, SLOT('showTime()')) @timer.start(1000) showTime() setWindowTitle(tr("Digital Clock")) resize(150, 60) end
Public Instance Methods
showTime()
click to toggle source
# File examples/widgets/digitalclock/digitalclock.rb, line 22 def showTime() time = Qt::Time.currentTime text = time.toString("hh:mm") if time.second % 2 == 0 text[2] = ' ' end display(text) end