wconstan
17th November 2009, 09:42
Goal:
I am using Qt Creator 1.2.92 and am trying to use the (changed) value of a spinBox widget in my application to dynamically alter the number of rows displayed in a QTableWidget widget.
What I have done:
I have succeeded in mapping the spinBox valueChanged signal to the QTableWidget insertRow slot using the "Edit signals/slots" mode while editing my file test.ui, which results in the following line in ui_test.h:
QObject::connect(spinBox, SIGNAL(valueChanged(int)), tableWidget, SLOT(insertRow(int)));
What I would like to do:
QObject::connect(spinBox, SIGNAL(valueChanged(int)), tableWidget, SLOT(setRowCount(int)));
However, when I run the associated application I get the following error after changing the spinBox value:
Object::connect: No such slot QTableWidget::setRowCount(int) in ui_test.h:137
Object::connect: (sender name: 'spinBox')
Object::connect: (receiver name: 'tableWidget')
I am completely new to Qt and to the Qt Creator and have had only a little exposure to C++. Is there a way to accomplish this? Any help would be most appreciated.
Thanks!
I am using Qt Creator 1.2.92 and am trying to use the (changed) value of a spinBox widget in my application to dynamically alter the number of rows displayed in a QTableWidget widget.
What I have done:
I have succeeded in mapping the spinBox valueChanged signal to the QTableWidget insertRow slot using the "Edit signals/slots" mode while editing my file test.ui, which results in the following line in ui_test.h:
QObject::connect(spinBox, SIGNAL(valueChanged(int)), tableWidget, SLOT(insertRow(int)));
What I would like to do:
QObject::connect(spinBox, SIGNAL(valueChanged(int)), tableWidget, SLOT(setRowCount(int)));
However, when I run the associated application I get the following error after changing the spinBox value:
Object::connect: No such slot QTableWidget::setRowCount(int) in ui_test.h:137
Object::connect: (sender name: 'spinBox')
Object::connect: (receiver name: 'tableWidget')
I am completely new to Qt and to the Qt Creator and have had only a little exposure to C++. Is there a way to accomplish this? Any help would be most appreciated.
Thanks!