[Qt-interest] Problem customizing QSpinBox

Judy Duncan jduncan at duncanimaging.com
Sun Apr 26 18:24:09 CEST 2009


Thanks for your comments.   That turned out to be exactly the problem.  I
had been trying lots of different things, adding and removing files, etc and
somewhere the qmake file got out of sync.  Once I got things cleaned up it
built with no problem and has been working fine ever since.

 

Thanks again,

Judy

 

From: Israel Brewster [mailto:israel at frontierflying.com] 
Sent: Wednesday, April 22, 2009 10:06 AM
To: Judy Duncan
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Problem customizing QSpinBox

 

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/20090426/137ee629/attachment.html 


More information about the Qt-interest-old mailing list