summaryrefslogtreecommitdiffstats
path: root/tests/manual/examples/widgets/itemviews/storageview/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/examples/widgets/itemviews/storageview/main.cpp')
-rw-r--r--tests/manual/examples/widgets/itemviews/storageview/main.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/manual/examples/widgets/itemviews/storageview/main.cpp b/tests/manual/examples/widgets/itemviews/storageview/main.cpp
new file mode 100644
index 0000000000..3bd5392736
--- /dev/null
+++ b/tests/manual/examples/widgets/itemviews/storageview/main.cpp
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Ivan Komissarov
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QApplication>
+#include <QShortcut>
+#include <QTreeView>
+
+#include "storagemodel.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ QTreeView view;
+ view.resize(640, 480);
+ view.setWindowTitle("Storage View");
+ view.setSelectionBehavior(QAbstractItemView::SelectRows);
+
+ StorageModel *model = new StorageModel(&view);
+ model->refresh();
+ QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, &view);
+ QObject::connect(refreshShortcut, &QShortcut::activated, model, &StorageModel::refresh);
+ view.setModel(model);
+
+ int columnCount = view.model()->columnCount();
+ for (int c = 0; c < columnCount; ++c)
+ view.resizeColumnToContents(c);
+ view.show();
+
+ return a.exec();
+}