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. ItemIgnoresTransformations setPos
Forum Updated to NodeBB v4.3 + New Features

ItemIgnoresTransformations setPos

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 394 Views 1 Watching
  • 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.
  • T Offline
    T Offline
    tobycronin
    wrote on last edited by
    #1

    Hi, I have a QGraphicsRectItem with 8 resize handles each with the ItemIgnoresTransformations flag set. I set their pos using setPos relative to their parents rect as follows:

    @
    void CanvasItem::updateHandlePositions()
    {
    double hw = m_handleItems[0]->rect().width()/2;
    double hh = m_handleItems[0]->rect().height()/2;

    for (int i = 0; i < m_handleItems.count(); ++i) {
    case CanvasHandle::TopLeft:
    m_handleItems[i]->setPos(rect().left() - hw,
    rect().top() - hh);
    break;
    case CanvasHandle::Top:
    m_handleItems[i]->setPos(rect().center().x(),
    rect().top() - hw);
    break;
    @

    This sets their positions as shown in a previous post of mine (http://qt-project.org/forums/viewthread/41647/) The problem is that when I scale the view using the following:

    @
    setTransform(QTransform::fromScale(scale, scale));
    @

    the handle is no longer anchored to the corner of the parent rect:

    !http://s30.postimg.org/ga4bmo14t/Screen_Shot_2014_04_24_at_15_42_48.png(handle offset from parent)!

    Can anyone point out what I'm doing wrong?

    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