Results 1 to 11 of 11

Thread: Rubberband painting on multiselection in a list view

  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Rubberband painting on multiselection in a list view

    Hi all, I'm using Qt4.1.0 on WindowsXp. I have a QListWidget that accepts multiselections of items. I call to QAbstractItemView::setSelectionMode(QAbstractItemV iew::MultiSelection) and the items are multi selected but no rubberband is painted to see which items are you selecting and it's a bit annoying. Does anybody knows a simple way to show the rubberband or I am forced to use the QRubberband class. As I remember, in Qt3 the rubberband is shown by default in multiselection mode...

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Rubberband painting on multiselection in a list view

    In Qt4 the rubber band is shown only in icon mode. If you want, you can change to icon mode, position the icons from top to bottom and change movement property to static. You'll end up with something close to list mode and a rubber band.

    But using a rubber band in list mode doesn't make much sense anyway, because if you drag, you always select a sequence of elements, so you know what you are selecting. This is not true for icons.

    Of course you can always subclass or install an event filter and draw the band yourself.

  3. #3
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rubberband painting on multiselection in a list view

    wysota, the strange thing is that I have the list in icon mode That's how I configure it:
    Qt Code:
    1. llistaFotosPetites = new QListWidget;
    2. llistaFotosPetites -> setViewMode(QListView::IconMode);
    3. llistaFotosPetites -> setIconSize(QSize(TAM_ICON_HOR, TAM_ICON_VER));
    4. llistaFotosPetites -> setFlow(QListView::LeftToRight);
    5. llistaFotosPetites -> setMovement(QListView::Static);
    6. llistaFotosPetites -> setResizeMode(QListView::Adjust);
    7. //llistaFotosPetites -> setLayoutMode(QListView::Batched);
    8. llistaFotosPetites -> setWrapping(true);
    9. llistaFotosPetites -> setTextElideMode(Qt::ElideRight);
    10. //llistaFotosPetites -> setSpacing(8);
    11. llistaFotosPetites -> setGridSize(QSize(TAM_GRID_HOR, TAM_GRID_VER));
    12. llistaFotosPetites -> setUniformItemSizes(true);
    13. llistaFotosPetites -> setSelectionMode(QAbstractItemView::ExtendedSelection);
    14. llistaFotosPetites -> setFrameShape(QFrame::NoFrame);
    To copy to clipboard, switch view to plain text mode 

    Do you know why the rubberband doesn't appear?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Rubberband painting on multiselection in a list view

    Change ExtendedSelection to MultiSelection.

  5. #5
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rubberband painting on multiselection in a list view

    Quote Originally Posted by wysota
    Change ExtendedSelection to MultiSelection.
    I've tried it in both modes but the rubberband doesnt' appears

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Rubberband painting on multiselection in a list view

    Hmm... strange. It works for me (4.1.1) Try making a simple dialog in Designer which consists of a list widget with some items and check (under preview) if you see a rubber band.

  7. #7
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rubberband painting on multiselection in a list view

    You're right wysota with designer appears the rubberband, strange It's like if a option that I've activated disables the rubberband or something. I attach an image to show you that the multiselections are enabled...
    Attached Images Attached Images

  8. #8
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rubberband painting on multiselection in a list view

    Maybe the problem could be that the list widget is inside a tab widget?

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Rubberband painting on multiselection in a list view

    No, not likely. You can take a look at Qt sources to see if there are any requirements for the band to be drawn (in QListView class).

  10. #10
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rubberband painting on multiselection in a list view

    Finally I've found where it disables the rubberband: fixing the movement to static Very strange, I think that both things have not strictly relationship. A bug of Qt? Could anybody tell me if with the new version (4.1.1) it also locks the rubberband?
    Last edited by SkripT; 18th March 2006 at 10:09.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Rubberband painting on multiselection in a list view

    In 4.1.1 with static movement the rubber band is drawn.

  12. The following user says thank you to wysota for this useful post:

    SkripT (19th March 2006)

Similar Threads

  1. make QTableView work as a multi-column list view
    By wesley in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2008, 14:43
  2. multiple selection of list view items
    By samirg in forum Qt Programming
    Replies: 2
    Last Post: 30th October 2007, 19:05
  3. Replies: 1
    Last Post: 22nd October 2007, 02:04
  4. Replies: 1
    Last Post: 14th May 2007, 14:55
  5. Custom widget in list view
    By fusoin23 in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2006, 14:09

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.