Results 1 to 6 of 6

Thread: Set EllipseItem center to position

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set EllipseItem center to position

    This is a part of my code which I would like to work:
    Qt Code:
    1. m_originationPoint = m_scene->addEllipse(0,0,6,6);
    2. m_originationPoint->setFlag(QGraphicsItem::ItemIgnoresTransformations);
    3. m_originationPoint->setZValue(1);
    4. ......
    5. void MyClass::vSetPos(QPointF _pos) {
    6. m_originationPoint->setPos(_pos);// This sets the topLeft boundingRect
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 

    Thanks for any ideas.
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

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

    Default Re: Set EllipseItem center to position

    Simply make the ellipse start from -3, -3 and extend 6 units wide and 6 unit high instead of 0,0 and 6,6. It should all work then - setPos() will set the position of the centre of the ellipse.

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

    maverick_pol (15th May 2008)

  4. #3
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set EllipseItem center to position

    Hi,

    Unfortunately, for me, your are totally right. This works.
    Why unfortunately? Because I have found a different solution, which was far more complex and I coded it.
    Ok...Sorry for the stupid problem.

    Kacper
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

Similar Threads

  1. Drawing QGraphicsSvgItem from center
    By Mhondoz in forum Qt Programming
    Replies: 3
    Last Post: 14th March 2008, 20:33

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.