[Qt-interest] Problem customizing QSpinBox
Judy Duncan
jduncan at duncanimaging.com
Mon Apr 20 20:16:23 CEST 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090420/c8b218f9/attachment.html
More information about the Qt-interest-old
mailing list