Results 1 to 3 of 3

Thread: Conceptual error findings

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

    Default Conceptual error findings

    Hello forum,

    I would like to clear some of the basic concepts about the QGraphicsItem .

    The origin(0,0) of all the QGraphicsItem is at center except QGraphicsTextItem . its origin is at the upper left corner.

    What happens if one of the QGraphicsIten contians the QGraphicsTextItem object as a child?

    What would be the origin of the composed item. The manual does not say about this transition issues detail enough.

    I hope some one in the forum will.


    Regards
    Sajjad

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Conceptual error findings

    There isn't such a concept as origin. There is position, and a transform (and a bounding rect).

    The rules for what happens under 'composition' is the same as for any other combination of graphics items - the position of a child is relative to its parent.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    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: Conceptual error findings

    Each item lives in its own coordinate space. The geometry of each item is determined by what its boundingRect() implementation returns. So if you have an item containing some other item then they have their own coordinate systems and the origin of the parent item does not depend in any way on the origin of its child items (if it has any at all). It works the other way too --- the origin of the child item does not depend on the origin of the parent item. However the placement of the child item does depend on the origin of the parent item since positions of items are expressed in their parent's coordinate space.
    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.


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

    sajis997 (5th March 2012)

Similar Threads

  1. Replies: 4
    Last Post: 29th April 2014, 16:20
  2. : error: [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\V ideo.exe] Error 1
    By ranjit.kadam in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 1st May 2011, 22:11
  3. Had a Conceptual doubts on QGraphicsItemAnimation ?
    By punitk in forum Qt Programming
    Replies: 3
    Last Post: 7th October 2010, 11:23
  4. Conceptual Question; QLabel as Banner?
    By SneakyPeterson in forum Newbie
    Replies: 5
    Last Post: 28th June 2010, 08:18
  5. Conceptual MVC problem in Qt
    By Daniel Dekkers in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2010, 16:26

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.