Results 1 to 2 of 2

Thread: Multiple rubber band selections?

  1. #1
    Join Date
    May 2012
    Posts
    9
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Multiple rubber band selections?

    Hello, I have a rubber band selection enabled in my application and similar to adding new items to the selection via CTRL+Click, I would like to add multiple items with another rubber band to the existing group of selections -e.g. when I press shift, hold it, and use mouse to select another group of items, they should also be added to my current selection- what would be the best way to do this? I'm thinking of adding a SHIFT key event modifier check and do it there but I couldn't figure out how to connect the new rubber band selection with the previous one -maybe using the initial list of selected items and appending them to the current selected ones under that if check for shift key?- Thanks.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Multiple rubber band selections?

    Somewhere in the class that handles the mouse actions, you need to save the initial selection list. The next time selection occurs, you must check for the SHIFT key (or whatever you decide to use to indicate extended selection) and set a flag that tells the rubberband code to append to the current list (SHIFT pressed) or discard the current list and replace it with the new selection (no SHIFT pressed).

    You should also consider handling the ESC key to cancel the selection mode to allow the user to get out without destroying the initial selection.
    <=== 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.

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

    s7 (11th August 2012)

Similar Threads

  1. Qt Creator how to disable two finger scroll rubber band
    By Markus in forum Qt Tools
    Replies: 0
    Last Post: 5th April 2012, 23:01
  2. How do I clear the rubber band after a selection is done
    By aarelovich in forum Qt Programming
    Replies: 1
    Last Post: 15th July 2010, 12:29
  3. Replies: 2
    Last Post: 17th June 2010, 13:38
  4. How to draw rubber band using XOR
    By lni in forum Qt Programming
    Replies: 2
    Last Post: 21st September 2009, 12:13
  5. Rubber band artifacts?
    By mooreaa in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2008, 18:19

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.