Results 1 to 2 of 2

Thread: select a QGraphicsitem and all it's child items

  1. #1
    Join Date
    May 2013
    Posts
    24
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default select a QGraphicsitem and all it's child items

    Hi,

    I want to select a qgraphicsitem and all it's child items when a select the parent item. How can I do this? Where should I start?
    Now only the item which I clicked on is selected.

    Thanks!

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: select a QGraphicsitem and all it's child items

    Use QList<QGraphicsItem *> QGraphicsItem::childItems() const to get the children list and call void QGraphicsItem::setSelected(true) on all the items in the list. You could add this in a slot connected to void QGraphicsScene::selectionChanged() [signal] of the QGraphicsScene
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Select multiple items in a combobox
    By sousadaniel7 in forum Qt Programming
    Replies: 11
    Last Post: 3rd May 2012, 13:57
  2. Replies: 7
    Last Post: 29th November 2010, 19:20
  3. Select all items in QTreeView. Why very slow ?
    By MaxBooster in forum Qt Programming
    Replies: 0
    Last Post: 25th August 2010, 06:12
  4. QListWidget on Mac Intel 64 Can't select top two items
    By jpbaugh in forum Qt Programming
    Replies: 2
    Last Post: 15th April 2009, 17:52
  5. Casting QGraphicsItem child from QGraphicsItem
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2008, 15:37

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.