Results 1 to 2 of 2

Thread: doubt in padnavigator example

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default doubt in padnavigator example

    hi friends,
    i am following the padnavigator example ... /qt4.4.3/example/graphicsview/padnavigator

    in this example
    in roundrectitem.h
    the code is
    Qt Code:
    1. class RoundRectItem : public QObject, public QGraphicsRectItem
    2. {
    3. Q_OBJECT
    4. public:
    5. RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget = 0);
    To copy to clipboard, switch view to plain text mode 

    why we want to inherit QObject and also the Q_OBJECT macro .. either one is enough ...?

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

    Default Re: doubt in padnavigator example

    Because we want signals and slots to be available for the item - we need to inherit QObject for that and without Q_OBJECT macro one can't add new signals or slots to the class.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    wagmare (13th May 2009)

Similar Threads

  1. doubt in blocking fortune client example
    By wagmare in forum Qt Programming
    Replies: 9
    Last Post: 19th February 2009, 13:50
  2. Replies: 2
    Last Post: 10th January 2008, 12:52
  3. Doubt about includes
    By xEsk in forum Newbie
    Replies: 2
    Last Post: 15th November 2007, 20:20
  4. QGraphicsItem HoverEvent Doubt
    By arjunasd in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2007, 17:40
  5. Doubt ?
    By Cutey in forum Qt Tools
    Replies: 2
    Last Post: 3rd March 2007, 09:45

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.