Fix QTreeView ending up in wrong state when drag

Changed state in MouseRelease so that QTreeView
does not end up in wrong state if drag is started
but not completed.

Task-number: QTBUG-44773
Change-Id: I0b665d2944f2b696bc4b7e79689d110aefa3f194
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
This commit is contained in:
Katja Marttila 2015-03-03 12:23:29 +02:00 committed by Thorbjørn Lund Martsum
parent 7f8da2179b
commit 2596f95b3b

View File

@ -1913,7 +1913,7 @@ void QTreeView::mouseReleaseEvent(QMouseEvent *event)
if (d->itemDecorationAt(event->pos()) == -1) {
QAbstractItemView::mouseReleaseEvent(event);
} else {
if (state() == QAbstractItemView::DragSelectingState)
if (state() == QAbstractItemView::DragSelectingState || state() == QAbstractItemView::DraggingState)
setState(QAbstractItemView::NoState);
if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonRelease)
d->expandOrCollapseItemAtPos(event->pos());