Sha256: 3a6f717923981b9fa324cebb4c2c351771ea1db28d35e28af4885fa58636b052

Contents?: true

Size: 526 Bytes

Versions: 25

Compression:

Stored size: 526 Bytes

Contents

require 'Qt'

class DigitalClock < Qt::LCDNumber

	slots 'showTime()'

	# Constructs a DigitalClock widget
	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

	def showTime()
		time = Qt::Time.currentTime
		text = time.toString("hh:mm")
		if time.second % 2 == 0
			text[2] = ' '
		end
		display(text)
	end
end

Version data entries

25 entries across 23 versions & 3 rubygems

Version Path
rock-qtbindings-4.8.6.5 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.6.5 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.6.4 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.6.2 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.6.1 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.6.0 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.6.0-x86-mingw32 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.5.2 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.5.2-x86-mingw32 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.5.1 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.5.0 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.3.0-x86-mingw32 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.8.3.0 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.6.3.4-x86-mingw32 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.6.3.4 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.6.3.3 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.6.3.2-x86-mingw32 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.6.3.2 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.6.3.1 examples/widgets/digitalclock/digitalclock.rb
qtbindings-4.6.3.1-x86-mingw32 examples/widgets/digitalclock/digitalclock.rb