summaryrefslogtreecommitdiffstats
path: root/tests/manual/examples/widgets/itemviews/storageview/storagemodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/examples/widgets/itemviews/storageview/storagemodel.h')
-rw-r--r--tests/manual/examples/widgets/itemviews/storageview/storagemodel.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/manual/examples/widgets/itemviews/storageview/storagemodel.h b/tests/manual/examples/widgets/itemviews/storageview/storagemodel.h
new file mode 100644
index 0000000000..f8cc3289c8
--- /dev/null
+++ b/tests/manual/examples/widgets/itemviews/storageview/storagemodel.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Ivan Komissarov
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef STORAGEMODEL_H
+#define STORAGEMODEL_H
+
+#include <QAbstractTableModel>
+#include <QStorageInfo>
+
+class StorageModel : public QAbstractTableModel
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(StorageModel)
+public:
+ enum Column {
+ ColumnRootPath = 0,
+ ColumnName,
+ ColumnDevice,
+ ColumnFileSystemName,
+ ColumnTotal,
+ ColumnFree,
+ ColumnAvailable,
+ ColumnIsReady,
+ ColumnIsReadOnly,
+ ColumnIsValid,
+ ColumnCount
+ };
+
+ using QAbstractTableModel::QAbstractTableModel;
+
+ int columnCount(const QModelIndex &parent) const override;
+ int rowCount(const QModelIndex &parent) const override;
+
+ QVariant data(const QModelIndex &index, int role) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+
+public slots:
+ void refresh();
+
+private:
+ QList<QStorageInfo> m_volumes;
+};
+
+#endif // STORAGEMODEL_H