mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2024-11-30 15:56:52 +08:00
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||
|
|
||
|
#ifndef PIECESLIST_H
|
||
|
#define PIECESLIST_H
|
||
|
|
||
|
#include <QAbstractListModel>
|
||
|
#include <QPixmap>
|
||
|
#include <QPoint>
|
||
|
#include <QStringList>
|
||
|
#include <QList>
|
||
|
|
||
|
QT_BEGIN_NAMESPACE
|
||
|
class QMimeData;
|
||
|
QT_END_NAMESPACE
|
||
|
|
||
|
class PiecesModel : public QAbstractListModel
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit PiecesModel(int pieceSize, QObject *parent = nullptr);
|
||
|
|
||
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||
|
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
||
|
|
||
|
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||
|
int row, int column, const QModelIndex &parent) override;
|
||
|
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
||
|
QStringList mimeTypes() const override;
|
||
|
int rowCount(const QModelIndex &parent) const override;
|
||
|
Qt::DropActions supportedDropActions() const override;
|
||
|
|
||
|
void addPiece(const QPixmap &pixmap, const QPoint &location);
|
||
|
void addPieces(const QPixmap &pixmap);
|
||
|
|
||
|
private:
|
||
|
QList<QPoint> locations;
|
||
|
QList<QPixmap> pixmaps;
|
||
|
|
||
|
int m_PieceSize;
|
||
|
};
|
||
|
|
||
|
#endif // PIECESLIST_H
|