Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
4.4.0
-
None
Description
It seems extended selections and shift clicking has strange behaviour.
On windows the initial faint selection rectangle explains some of this behavior, but on mac the behavior is even less obvious.
Consider a demo application with three items A B and C in a list widget.
Start this app up and shift click "C". There was no prior
selection so expected result is that only "C" is selected.
Instead "A" and "B" get selected too. Next, click off to clear the selection, aka click below "C" in the list. Now try shift-clicking "C" again. Based on the bizarre behavior we saw before we'd expect all three entries to be
selected again. Nope. NOTHING gets selected this time.
In both situations the most correct result would be that only "C" should be
selected.
Here is the demo application :
#include <QtGui>
class Widget : public QWidget
{
public:
Widget(QWidget *parent);
};
Widget::Widget(QWidget *parent) : QWidget(parent)
{
QListWidget* list1 = new QListWidget();
list1->setSelectionMode(QAbstractItemView::ExtendedSelection);
list1->addItem("A");
list1->addItem("B");
list1->addItem("C");
QGridLayout* grid = new QGridLayout(this);
grid->addWidget(list1, 0,0);
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Widget w(NULL); w.show();
return app.exec();
}