Sha256: d60724c7e1c5c925c7040db63f9caf12ed524de2645e0dd54496b8b945aaeab3

Contents?: true

Size: 1.01 KB

Versions: 25

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby -w

# This is the EventFilter example from Chapter 16 of 'Programming with Qt'

require 'Qt'

class KillerFilter < Qt::Object

	def eventFilter( object, event )
		if event.type() == Qt::Event::MouseButtonPress
			if event.button() == Qt::RightButton
				object.close()
				return true
			else
				return false
			end
		else
			return false
		end
	end

end
	
a = Qt::Application.new(ARGV)
	
toplevel = Qt::Widget.new
toplevel.resize(230, 130)

killerfilter = KillerFilter.new

pb = Qt::PushButton.new(toplevel)
pb.setGeometry( 10, 10, 100, 50 )
pb.text = "pushbutton"
pb.installEventFilter(killerfilter)

le = Qt::LineEdit.new(toplevel)
le.setGeometry( 10, 70, 100, 50 )
le.text = "Line edit"
le.installEventFilter(killerfilter)

cb = Qt::CheckBox.new(toplevel)
cb.setGeometry( 120, 10, 100, 50 )
cb.text = "Check-box"
cb.installEventFilter(killerfilter)

rb = Qt::RadioButton.new(toplevel)
rb.setGeometry( 120, 70, 100, 50 )
rb.text = "Radio button"
rb.installEventFilter(killerfilter)

toplevel.show
a.exec


	

Version data entries

25 entries across 23 versions & 3 rubygems

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