From a1c985c10bf2212e911777568c6e344456293a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Thu, 12 Oct 2017 10:58:06 +0200 Subject: QAbstractItemView: Make it easier to drop above and below items Before this patch a very accurate drop position below or above an index was needed. Therefore it was not that easy to do. This patch increases the above/below area to be about 18% of the item (still leaving the most space for the item). An average user will likely be 2-3x faster with dropping below or above (while not losing much when dropping on items). [ChangeLog][QtWidgets][ItemViews] Made it easier to drop above and below items. Change-Id: I47f0f80c76878c17ebf3f93d0a0cc82755971c2a Reviewed-by: Andy Shaw Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qabstractitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 15e6b0eb99..23e727e670 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2194,7 +2194,7 @@ QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const Q { QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport; if (!overwrite) { - const int margin = 2; + const int margin = qBound(2, qRound(qreal(rect.height()) / 5.5), 12); if (pos.y() - rect.top() < margin) { r = QAbstractItemView::AboveItem; } else if (rect.bottom() - pos.y() < margin) { -- cgit v1.2.3