Results 1 to 6 of 6

Thread: remove flags?

  1. #1

    Default remove flags?

    Hallo,
    I have created an item in a GraphicsScene (item->setFlag(QGraphicsItem::ItemIsMovable) in the scene) and I have a subclass where I would draw a line when the item is selected (setFlag(QGraphicsItem::ItemIsSelectable) in the subclass) . But my problem is, that the item is movable and selected at the same time.
    I would like that the item is not movable when I select it and draw the line....
    How can I do this?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

  3. #3

    Default Re: remove flags?

    Thanks, but I've tried and it doesn't work
    Is there another possibility?

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: remove flags?

    you can
    * try QGraphicsItem::setFlags(),
    * dump the set QGraphicsItem::flags() to check that that flag is not set
    * if it is still set: check your code for places where the flag might get set ;-)

  5. #5

    Default Re: remove flags?

    Now I've tried this:
    graphicsscene.cpp
    Qt Code:
    1. void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *e)
    2. {
    3. pos=e->scenePos();
    4.  
    5. EllipseItem *item = new EllipseItem(pos.x()-5, pos.y()-5,10,10);
    6. item->setFlag(QGraphicsItem::ItemIsSelectable);
    7. addItem(item);
    8.  
    9. if(item->isSelected())
    10. { item->setFlag(QGraphicsItem::ItemIsMovable, false); }
    11. else
    12. { item->setFlag(QGraphicsItem::ItemIsMovable, true); }
    13. }
    To copy to clipboard, switch view to plain text mode 

    but it doesn't work too....Can you tell me why?
    It seems that the scene ignore item->setFlag(QGraphicsItem::ItemIsMovable, false).

  6. #6
    Join Date
    Mar 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Exclamation Re: remove flags? Need Help!!

    made new thread
    Last edited by Noroxus; 18th March 2015 at 02:35.

Similar Threads

  1. remove node in xml file
    By mattia in forum Newbie
    Replies: 1
    Last Post: 6th March 2008, 13:25
  2. QSplashScreen Weirdness
    By mclark in forum Qt Programming
    Replies: 11
    Last Post: 19th November 2007, 06:49
  3. Remove QSizeGrip/Size Grip from a QWidget or QDialog?
    By Cheetah in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2007, 16:35
  4. QRegExp Help; remove all html tag
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 27th July 2006, 13:40
  5. QSettings again ... how to remove array elements
    By Mike in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 08:58

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.