Details
-
Bug
-
Resolution: Cannot Reproduce
-
P4: Low
-
4.4.0
-
None
Description
Inconsistent behavior can be observed when dragging items around a QTreeView. When the pointer is exactly between items instead of selecting one item in a drag operation the drag becomes a select.
This can be seen with the following behavior.
Start the example application below and with no modifier keys down click and hold the mouse between two items.
One of the items gets selected. Then with the mouse still down drag away from the selected one. For instance straight up if row8 got
selected.
If the mouse pointer is located in the narrow spot between items instead of dragging the item that is selected a selection drag is performed.
#include <QtGui/QtGui>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QTreeView* view = new QTreeView(0);
view -> setSelectionMode(QAbstractItemView::ExtendedSelection);
view -> setDragDropMode(QAbstractItemView::DragDrop);
view -> setDragEnabled(true);
QStandardItemModel *model = new QStandardItemModel(8,1,0);
for (int row = 0; row < 8; row++)
view->setModel(model);
view->show();
return app.exec();
}