Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Silly question: QGraphicsEllipseItem

Silly question: QGraphicsEllipseItem

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brandont
    wrote on last edited by
    #1

    I'm just playing around with QGraphicsEllipseItem. I'm trying to do something like this:
    Ball.h
    @
    #ifndef BALL_H
    #define BALL_H

    #include <QtGui>

    class Ball : public QGraphicsEllipseItem
    {
    Q_OBJECT
    public:
    explicit Ball(void);
    };

    #endif // BALL_H
    @
    ball.cc
    @#include <QtGui>
    #include "Ball.h"

    Ball::Ball(void)
    : QGraphicsEllipseItem(85, 0, 30, 30)
    {
    setBrush(QBrush(Qt::red));
    setPen(QPen(Qt::red));
    }
    @

    For some reason I'm getting a "undefined reference to `vtable for Ball'" during the linking stage (gcc 4.4.5). Any ideas what I'm forgetting here? Thanks!

    1 Reply Last reply
    0
    • B Offline
      B Offline
      brandont
      wrote on last edited by
      #2

      I should add on to this I guess. The documentation specifies some virtual functions under "Reimplemented Public Functions". Do I have to re-re-implement them? Or is there something else I'm missing.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Frank
        wrote on last edited by
        #3

        QGraphicsItems are not QObjects, so remove that Q_OBJECT macro and rerun qmake if necessary.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          brandont
          wrote on last edited by
          #4

          Thanks! It worked.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved