Clicked() signal for QListView in Ruby
-
I have a ListView and when I click in a row I need show more information about this row. My problem is that the signal clicked() does not work for ListView. When I initialize my application I get the following output in console
Object::connect: No such signal QListView::clicked(index)
Object::connect: (sender name: 'appointments_list')And when I click in a row nothing happend.
@
class GUICustomerAppointmentDetail < Qt::Widgetdef initialize (parent = nil, customer = nil) super(parent) ... @ui.appointments_list.connect(SIGNAL('clicked(index)'), self, SLOT('load_data()')) end
end
@
appointments_list is a Qt::ListViewI have replaced
@
@ui.appointments_list.connect(SIGNAL('clicked(index)'), self, SLOT('load_data()'))
@
by
@
connect(appointments_list.connect, SIGNAL('clicked(index)'), self, SLOT('load_data()'))
@
and I getObject::connect: No such signal QListView::clicked(index)
Object::connect: (sender name: 'appointments_list')
Object::connect: (receiver name: 'customerAppointmentDetail')also
@
@ui.appointments_list.connect(SIGNAL('clicked(index)')){ load_data() }
@
and I get
Object::connect: No such signal QListView::clicked(index)
Object::connect: (sender name: 'appointments_list')Please, can anyone help me?
-
The signature for 'clicked' should be 'clicked(QModelIndex)' and not 'clicked(index)'
You may be interested in the alternative syntax I presented in the previous posting on this forum (Uniform Qt bindings for JRuby and Ruby). This eliminates the need to use signatures in application programs. You could than just have written:
require 'qt_connect'
.
.
list.clicked.connect{ load_data}(or list.clicked.connect{ |index| .... if you need to know which cell was clicked)
-
Hello CeesZ,
Looks great I will try!