I just love RUBY programming

T

t3chn0n3rd

#!/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
 
R

richard.j.dale

#!/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
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top