PDA

View Full Version : Q_OBJECT && QGraphicsView



hgedek
10th October 2007, 14:09
I inherited a GraphicsView class from QGraphicsView. I tried to use Q_Object in it.I need signals.But
graphicsview.o(.text+0x634): In function `GraphicsView::GraphicsView(QWidget*)':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0x860): In function `GraphicsView::GraphicsView(QWidget*)':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0xf3c): In function `GraphicsView::~GraphicsView()':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0x12e8): In function `GraphicsView::~GraphicsView()':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0x1694): In function `GraphicsView::~GraphicsView()':

these errors I got.Problem?

wysota
10th October 2007, 14:23
Did you add those files to your project file and rerun qmake? And it should be Q_OBJECT, not Q_Object.

rajesh
10th October 2007, 14:40
if you really added
Q_OBJECT (all caps) then this error should not come.

hgedek
10th October 2007, 14:46
class GraphicsView :public QGraphicsView
{
Q_OBJECT
public:
GraphicsView(QWidget *parent=0);
~GraphicsView();
void ShowImages(QStringList labelList,int groupId);
void ClearScene();

private:

void AddImages(int groupId);
void CreateImages();
void MakeCounts();
protected:
void keyPressEvent(QKeyEvent *event);
void focusInEvent(QFocusEvent *event);
bool event(QEvent *e);
private:
................................


Errors:

linking Form (g++)
graphicsview.o(.text+0x634): In function `GraphicsView::GraphicsView(QWidget*)':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0x860): In function `GraphicsView::GraphicsView(QWidget*)':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0xf3c): In function `GraphicsView::~GraphicsView()':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0x12e8): In function `GraphicsView::~GraphicsView()':
: undefined reference to `vtable for GraphicsView'
graphicsview.o(.text+0x1694): In function `GraphicsView::~GraphicsView()':
: undefined reference to `vtable for GraphicsView'
collect2: ld returned 1 exit status
gmake[1]: *** [Form] Error 1
Leaving directory /home/hgedek/Projects/Simplex/s5xx/Form
gmake: *** [sub-Form-make_default] Error 2
*** Exited with status: 2 ***

hgedek
10th October 2007, 14:50
Ok.I solved.Thanks.

rajesh
10th October 2007, 14:54
what was the problem?

hgedek
10th October 2007, 15:22
I forgot to qmake again after adding Q_OBJECT to class.Its all this.