mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-04 00:05:25 +08:00
6.5.3 clean
This commit is contained in:
32
tests/manual/examples/widgets/itemviews/storageview/main.cpp
Normal file
32
tests/manual/examples/widgets/itemviews/storageview/main.cpp
Normal file
@ -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();
|
||||
}
|
Reference in New Issue
Block a user