diff options
Diffstat (limited to 'tests/manual/examples/widgets/itemviews/pixelator/imagemodel.h')
-rw-r--r-- | tests/manual/examples/widgets/itemviews/pixelator/imagemodel.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/manual/examples/widgets/itemviews/pixelator/imagemodel.h b/tests/manual/examples/widgets/itemviews/pixelator/imagemodel.h new file mode 100644 index 0000000000..050ac6b790 --- /dev/null +++ b/tests/manual/examples/widgets/itemviews/pixelator/imagemodel.h @@ -0,0 +1,31 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef IMAGEMODEL_H +#define IMAGEMODEL_H + +#include <QAbstractTableModel> +#include <QImage> + +//! [0] +class ImageModel : public QAbstractTableModel +{ + Q_OBJECT + +public: + ImageModel(QObject *parent = nullptr); + + void setImage(const QImage &image); + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + +private: + QImage modelImage; +}; +//! [0] + +#endif // IMAGEMODEL_H |