Results 1 to 7 of 7

Thread: Q_OBJECT && QGraphicsView

  1. #1
    Join Date
    Jul 2007
    Posts
    104
    Thanks
    22
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Q_OBJECT && QGraphicsView

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Q_OBJECT && QGraphicsView

    Did you add those files to your project file and rerun qmake? And it should be Q_OBJECT, not Q_Object.

  3. The following user says thank you to wysota for this useful post:

    hgedek (10th October 2007)

  4. #3
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Q_OBJECT && QGraphicsView

    if you really added
    Q_OBJECT (all caps) then this error should not come.

  5. #4
    Join Date
    Jul 2007
    Posts
    104
    Thanks
    22
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Q_OBJECT && QGraphicsView

    class GraphicsView ublic 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 ***

  6. #5
    Join Date
    Jul 2007
    Posts
    104
    Thanks
    22
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Q_OBJECT && QGraphicsView

    Ok.I solved.Thanks.

  7. #6
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Q_OBJECT && QGraphicsView

    what was the problem?

  8. The following user says thank you to rajesh for this useful post:

    hgedek (10th October 2007)

  9. #7
    Join Date
    Jul 2007
    Posts
    104
    Thanks
    22
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Q_OBJECT && QGraphicsView

    I forgot to qmake again after adding Q_OBJECT to class.Its all this.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.