#!/usr/bin/env ruby
require ‘Qt’
class MyWidget < Qt::Widget
slots ‘but_clie()’
def initialize(parent=nil)
super(parent)
@table = Qt::Table.new(10,10,self)
connect(@table,SIGNAL(‘clicked()’),self,SLOT(‘but_clie
()’))
end
def but_clie
puts "clicked"
end
end
On Mar 2, 2:28 pm, t3chn0n3rd [email protected] wrote:
connect(@table,SIGNAL(‘clicked()’),self,SLOT(‘but_clie
()’))
end
def but_clie
puts "clicked"
end
end
Well there isn’t actually a Qt widget called Qt::Table, do you mean
Qt::TableWidget ?
You can connect a block to a signal like this if you prefer:
#!/usr/bin/env ruby
require ‘Qt4’
class MyWidget < Qt::Widget
def initialize(parent=nil)
super(parent)
@table = Qt::TableWidget.new(10, 10, self)
connect(@table, SIGNAL('cellClicked(int,int)'), self) do |r, c|
puts "cellClicked r: #{r} c: #{c}"
end
end
end
– Richard