2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// Copyright (C) 2016 Ivan Komissarov
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2014-05-06 16:14:21 +00:00
|
|
|
|
2018-11-24 16:29:15 +00:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QShortcut>
|
|
|
|
#include <QTreeView>
|
2014-05-06 16:14:21 +00:00
|
|
|
|
|
|
|
#include "storagemodel.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
|
|
|
QTreeView view;
|
|
|
|
view.resize(640, 480);
|
2017-09-20 09:36:42 +00:00
|
|
|
view.setWindowTitle("Storage View");
|
2014-05-06 16:14:21 +00:00
|
|
|
view.setSelectionBehavior(QAbstractItemView::SelectRows);
|
2017-09-20 09:36:42 +00:00
|
|
|
|
|
|
|
StorageModel *model = new StorageModel(&view);
|
|
|
|
model->refresh();
|
2020-09-29 11:09:19 +00:00
|
|
|
QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, &view);
|
2017-09-20 09:36:42 +00:00
|
|
|
QObject::connect(refreshShortcut, &QShortcut::activated, model, &StorageModel::refresh);
|
|
|
|
view.setModel(model);
|
|
|
|
|
2014-05-06 16:14:21 +00:00
|
|
|
int columnCount = view.model()->columnCount();
|
|
|
|
for (int c = 0; c < columnCount; ++c)
|
|
|
|
view.resizeColumnToContents(c);
|
|
|
|
view.show();
|
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|