[Qt-interest] Problem customizing QSpinBox

Israel Brewster israel at frontierflying.com
Wed Apr 22 19:06:28 CEST 2009


When I have run into this problem, I have found that the easiest  
solution is usually to do a full manual clean of the project. doing a  
"make clean" (or choosing the clean option in whatever IDE you may be  
using) seems to leave behind some things that can cause this problem.  
However, I have found that if I manually go in and remove all  
generated files that are left behind after the clean, such as the  
ui_<whatever>.h files, this error typically goes away. None of my  
projects are large enough to have made it worth trying to narrow down  
specifically what files cause this problem though :)
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------



On Apr 20, 2009, at 10:16 AM, Judy Duncan wrote:

> 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
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090422/dd506b00/attachment.html 


More information about the Qt-interest-old mailing list