diff options
author | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2017-10-12 10:58:06 +0200 |
---|---|---|
committer | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2017-10-18 10:45:21 +0000 |
commit | a1c985c10bf2212e911777568c6e344456293a65 (patch) | |
tree | 9637ba8c20206d9bd958585a260b953f9ab6ca26 /src/widgets | |
parent | 03c3ba1815c1fe71261c6ba194188f1c52fadb53 (diff) |
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 <andy.shaw@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |