diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-13 21:32:36 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-14 18:29:00 +0000 |
commit | b0cd3bcec4317ed859ea13b3a2b33742c6ccecfe (patch) | |
tree | 761cee3d4407c29a086bb7780ba069768eecd513 /examples/widgets/itemviews | |
parent | eed5514eaf03c04f1b93d0899789841b8488d9a6 (diff) |
Use QScroller in the Dir View example
We have never had enough examples that show how easy it is to install
a QScroller. In this case, one line makes a QTreeView flickable.
Pick-to: 5.15
Task-number: QTBUG-86090
Change-Id: Idb8b4709617befb261f3b78d63ddbdaf5ad18d6b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'examples/widgets/itemviews')
-rw-r--r-- | examples/widgets/itemviews/dirview/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/widgets/itemviews/dirview/main.cpp b/examples/widgets/itemviews/dirview/main.cpp index fcdf4c7ba4..20e5d45c95 100644 --- a/examples/widgets/itemviews/dirview/main.cpp +++ b/examples/widgets/itemviews/dirview/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -52,6 +52,7 @@ #include <QFileSystemModel> #include <QFileIconProvider> #include <QScreen> +#include <QScroller> #include <QTreeView> #include <QCommandLineParser> #include <QCommandLineOption> @@ -96,6 +97,9 @@ int main(int argc, char *argv[]) tree.resize(availableSize / 2); tree.setColumnWidth(0, tree.width() / 3); + // Make it flickable on touchscreens + QScroller::grabGesture(&tree, QScroller::TouchGesture); + tree.setWindowTitle(QObject::tr("Dir View")); tree.show(); |