summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThorbjørn Lund Martsum <tmartsum@gmail.com>2017-10-12 10:58:06 +0200
committerThorbjørn Lund Martsum <tmartsum@gmail.com>2017-10-18 10:45:21 +0000
commita1c985c10bf2212e911777568c6e344456293a65 (patch)
tree9637ba8c20206d9bd958585a260b953f9ab6ca26 /tests
parent03c3ba1815c1fe71261c6ba194188f1c52fadb53 (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 'tests')
-rw-r--r--tests/manual/widgets/itemviews/qtreewidget/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/manual/widgets/itemviews/qtreewidget/main.cpp b/tests/manual/widgets/itemviews/qtreewidget/main.cpp
index 5d129101fd..fb72c404a5 100644
--- a/tests/manual/widgets/itemviews/qtreewidget/main.cpp
+++ b/tests/manual/widgets/itemviews/qtreewidget/main.cpp
@@ -95,6 +95,18 @@ public:
item5sl.append("Approver");
/* QTreeWidgetItem *item4 =*/ new QTreeWidgetItem(item4, item5sl);
+ treeWidget->setDragEnabled(true);
+ treeWidget->viewport()->setAcceptDrops(true);
+ treeWidget->setDragDropMode(QAbstractItemView::InternalMove);
+
+ for (int u = 0; u < 12; ++u) {
+ const QString username = QString("Anonymous User %1").arg(u + 1);
+ QStringList info;
+ info << username << username << QString::number(u + 1) << QStringLiteral("Test user");
+ new QTreeWidgetItem(item4, info);
+ }
+
+ treeWidget->expandAll();
treeWidget->setColumnCount(item2sl.size());
QStringList itemInfo("First Name");
itemInfo.append("Last Name");
@@ -133,6 +145,7 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
ExampleDlg d;
+ d.resize(d.sizeHint() * 3);
d.show();
app.exec();
}