Results 1 to 2 of 2

Thread: Ctrl and Shift selection in QTreeWidget

  1. #1
    Join Date
    Mar 2006
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Smile Ctrl and Shift selection in QTreeWidget

    Hi,

    I am using QTreeWidget to display the No of items using QTreeWidgetItem like this

    Qt Code:
    1. n = new QTreeWidgetItem ((QTreeWidget*)0, QStringList ( strList ));
    2. n->setFlags ( n->flags() | Qt::ItemIsUserCheckable );
    3. n->setCheckState (0,Qt::Unchecked);
    To copy to clipboard, switch view to plain text mode 

    I set selectionbehaviour to QAbstractItemView::SelectItems
    and selectionmode to QAbstractItemView::ExtendedSelection

    Now If I select the items in treewidget using shift+arrow (or) ctrl+mouse pointer and press spacebar, the last item which is selected is checked. but i want to check all the items which are selected. How to achive this ?

    I am using Qt 4.2.2/windows

    Thanks
    *npc*

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Ctrl and Shift selection in QTreeWidget

    Quote Originally Posted by npc View Post
    Now If I select the items in treewidget using shift+arrow (or) ctrl+mouse pointer and press spacebar, the last item which is selected is checked. but i want to check all the items which are selected. How to achive this ?
    In my humble opinion, it doesn't sound like an intuitive action to do. A common (and suggested) approach is to provide an external widget to change the check state of all selected items. Here's a thread worth reading.
    J-P Nurmi

Similar Threads

  1. QListWidget selection behavior
    By Arthur in forum Qt Programming
    Replies: 1
    Last Post: 30th May 2006, 14:10

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.