Results 1 to 3 of 3

Thread: QGraphicsItem - issue

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Posts
    212
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    24

    Default QGraphicsItem - issue

    Hello Forum,

    I am subclassing the QGraphicsItem as follows:


    Qt Code:
    1. class RootGraphicsItem : public QObject , public QGraphicsItem
    2. {
    3. Q_OBJECT
    4. public:
    To copy to clipboard, switch view to plain text mode 



    And i am getting the error inside the paint function :


    Qt Code:
    1. RootGraphicsItem.cpp: In member function ‘virtual void RootGraphicsItem::paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)’:
    2. RootGraphicsItem.cpp:473: error: invalid use of incomplete type ‘struct QPainter’
    3. /usr/include/qt4/QtGui/qwindowdefs.h:64: error: forward declaration of ‘struct QPainter’
    4. RootGraphicsItem.cpp:488: error: invalid use of incomplete type ‘struct QPainter’
    5. /usr/include/qt4/QtGui/qwindowdefs.h:64: error: forward declaration of ‘struct QPainter’
    6. RootGraphicsItem.cpp:489: error: invalid use of incomplete type ‘struct QPainter’
    7. /usr/include/qt4/QtGui/qwindowdefs.h:64: error: forward declaration of ‘struct QPainter’
    8. RootGraphicsItem.cpp:491: error: invalid use of incomplete type ‘struct QPainter’
    9. /usr/include/qt4/QtGui/qwindowdefs.h:64: error: forward declaration of ‘struct QPainter’
    10. RootGraphicsItem.cpp:492: error: invalid use of incomplete type ‘struct QPainter’
    11. /usr/include/qt4/QtGui/qwindowdefs.h:64: error: forward declaration of ‘struct QPainter’
    12. RootGraphicsItem.cpp: At global scope:
    To copy to clipboard, switch view to plain text mode 


    Any hint on what i am missing ?


    Regards
    Sajjad

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: QGraphicsItem - issue

    The error message is telling you all you need! Include QPainter:
    Qt Code:
    1. #include <QtGui/QPainter>
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 7
    Last Post: 29th November 2010, 19:20
  2. Filling a QGraphicsItem
    By c_srikanth1984 in forum Qt Programming
    Replies: 15
    Last Post: 6th July 2009, 14:34
  3. Replies: 6
    Last Post: 7th October 2008, 12:14
  4. Casting QGraphicsItem child from QGraphicsItem
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2008, 15:37
  5. Replies: 2
    Last Post: 28th June 2008, 16:31

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
  •  
Qt is a trademark of The Qt Company.