Results 1 to 2 of 2

Thread: Adding ItemIsMovable flag to QGraphicsProxyWidget breaks its positioning

  1. #1
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Adding ItemIsMovable flag to QGraphicsProxyWidget breaks its positioning

    Observe this simple scene example which puts two buttons on the scene:


    Qt Code:
    1. auto ww = new QGraphicsProxyWidget();
    2. ww->setWidget(new QPushButton());
    3. ww->setPos(900, 900);
    4.  
    5. auto ww2 = new QGraphicsProxyWidget();
    6. ww2->setWidget(new QPushButton());
    7. ww2->setPos(500, 500);
    8.  
    9. auto scene = new QGraphicsScene();
    10. scene->addItem(ww);
    11. scene->addItem(ww2);
    12.  
    13. auto view = new QGraphicsView();
    14. view->resize(1000, 1000);
    15. view->setScene(scene);
    16. view->show();
    To copy to clipboard, switch view to plain text mode 


    Everything works fine, and the two buttons appear at the specified positions.

    However, if we now add the itemismovable flag to them like so:


    Qt Code:
    1. auto ww = new QGraphicsProxyWidget();
    2. ww->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
    3. ww->setWidget(new QPushButton());
    4. ww->setPos(900, 900);
    5.  
    6. auto ww2 = new QGraphicsProxyWidget();
    7. ww2->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
    8. ww2->setWidget(new QPushButton());
    9. ww2->setPos(500, 500);
    10.  
    11. ...
    To copy to clipboard, switch view to plain text mode 



    the the initial position of the items breaks. They both put over each other at position (0,0). However, if I call ww->setPos(...) after the view is shown, then that works.


    Any idea what might be causing this?






    Environment:

    Qt 5.7
    VS2013U5
    Windows7SP1

  2. #2
    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: Adding ItemIsMovable flag to QGraphicsProxyWidget breaks its positioning

    Seems like a bug.
    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.


Similar Threads

  1. Replies: 8
    Last Post: 29th July 2012, 01:28
  2. help positioning QGraphicsProxyWidget?
    By Scott Shiff in forum Qt Programming
    Replies: 1
    Last Post: 24th January 2010, 23:13
  3. ItemIsMovable???
    By konvex in forum Qt Programming
    Replies: 3
    Last Post: 13th December 2008, 16:01
  4. Adding QGraphicsProxyWidget items into QGraphicsScene
    By yagabey in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 06:33
  5. QGraphicsItem::itemIsMovable
    By steg90 in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2007, 11:53

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.