[Qt-interest] Problem customizing QSpinBox
Malyushytsky, Alex
alex at wai.com
Tue Apr 21 01:54:16 CEST 2009
As for vtable or virtual table, it is probably better than I possibly ever could explained in C++ books.
So I will leave it up to you to learn this. You probably could at least google "vtable in C++".
As for the problem, check that apropriate moc file is created and added to the project.
Regards,
Alex
________________________________________
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Judy Duncan
Sent: Monday, April 20, 2009 11:16 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Problem customizing QSpinBox
I'm trying to sub-class a QSpinBox so that I can get a signal when editing is finished that passes the value in the spinbox along with the signal. Following some other examples, I have:
//*** header ****
#include <QSpinBox>
class SpinBox : public QSpinBox
{
Q_OBJECT
public:
SpinBox (QWidget *parent = 0);
private slots:
void valChange ();
signals:
void valueUpdate ( int value );
};
//*** implementation ****
#include "spinbox.h"
SpinBox::SpinBox(QWidget *parent)
: QSpinBox(parent)
{
connect (this, SIGNAL(editingFinished()),
this, SLOT(valChange()));
}
void SpinBox::valChange()
{
emit valueUpdate( this->value() );
}
I am using Designer for the mainwindow, so I put a QSpingBox on the form and then promoted it to a custom SpinBox, giving Designer the appropriate header file name.
When I build the project, I get the following link errors:
C:/DunImg/QtTest/Test2/spinbox.cpp:6: undefined reference to `vtable for SpinBox'
C:/DunImg/QtTest/Test2/spinbox.cpp:6: undefined reference to `vtable for SpinBox'
debug/spinbox.o: In function `ZN7SpinBoxC1EP7QWidget':
C:/DunImg/QtTest/Test2/spinbox.cpp:6: undefined reference to `vtable for SpinBox'
C:/DunImg/QtTest/Test2/spinbox.cpp:6: undefined reference to `vtable for SpinBox'
debug/spinbox.o: In function `ZN7SpinBox9valChangeEv':
C:/DunImg/QtTest/Test2/spinbox.cpp:13: undefined reference to `SpinBox::valueUpdate(int)'
collect2: ld returned 1 exit status
What's the vtable and why does it thing valueUpdate is undefined?
Thanks in advance,
Judy
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
More information about the Qt-interest-old
mailing list