Results 1 to 2 of 2

Thread: Change color of non selected items in QGraphicsScene/View

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,320
    Thanks
    316
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Change color of non selected items in QGraphicsScene/View

    Connect a slot to the QGraphicsScene::selectionChanged() signal. In the slot, retrieve the QList of selected items QGraphicsScene::selectedItems(). Use that list to change the colors. If you keep a copy of the previous selections (initially empty), then you can change the colors only for the items that are not common to the old and new selection lists for better efficiency.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. The following user says thank you to d_stranz for this useful post:

    s7 (9th August 2012)

Similar Threads

  1. QGraphicsScene sorting selected items
    By akiross in forum Qt Programming
    Replies: 1
    Last Post: 2nd April 2011, 19:23
  2. How change selected item rectangle on QGraphicsScene
    By xray2000 in forum Qt Programming
    Replies: 1
    Last Post: 18th May 2010, 16:43
  3. Replies: 3
    Last Post: 22nd January 2010, 16:46
  4. background color of not selected tab
    By iridium in forum Qt Programming
    Replies: 0
    Last Post: 13th August 2009, 15:57
  5. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 22:25

Tags for this Thread

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.