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
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.
Re: Rubberband painting on multiselection in a list view
wysota, the strange thing is that I have the list in icon mode :confused: That's how I configure it:
Code:
llistaFotosPetites
-> setViewMode
(QListView::IconMode);
llistaFotosPetites
-> setIconSize
(QSize(TAM_ICON_HOR, TAM_ICON_VER
));
llistaFotosPetites
-> setFlow
(QListView::LeftToRight);
llistaFotosPetites
-> setMovement
(QListView::Static);
llistaFotosPetites
-> setResizeMode
(QListView::Adjust);
//llistaFotosPetites -> setLayoutMode(QListView::Batched);
llistaFotosPetites -> setWrapping(true);
llistaFotosPetites -> setTextElideMode(Qt::ElideRight);
//llistaFotosPetites -> setSpacing(8);
llistaFotosPetites
-> setGridSize
(QSize(TAM_GRID_HOR, TAM_GRID_VER
));
llistaFotosPetites -> setUniformItemSizes(true);
llistaFotosPetites
-> setFrameShape
(QFrame::NoFrame);
Do you know why the rubberband doesn't appear?
Re: Rubberband painting on multiselection in a list view
Change ExtendedSelection to MultiSelection.
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
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.
1 Attachment(s)
Re: Rubberband painting on multiselection in a list view
You're right wysota with designer appears the rubberband, strange :confused: 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...
Re: Rubberband painting on multiselection in a list view
Maybe the problem could be that the list widget is inside a tab widget? :confused:
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).
Re: Rubberband painting on multiselection in a list view
Finally I've found where it disables the rubberband: fixing the movement to static :eek: 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?
Re: Rubberband painting on multiselection in a list view
In 4.1.1 with static movement the rubber band is drawn.