| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
| 3 |
|
| 4 |
#ifndef PIECESLIST_H |
| 5 |
#define PIECESLIST_H |
| 6 |
|
| 7 |
#include <QListWidget> |
| 8 |
|
| 9 |
class PiecesList : public QListWidget |
| 10 |
{ |
| 11 |
Q_OBJECT |
| 12 |
|
| 13 |
public: |
| 14 |
explicit PiecesList(int pieceSize, QWidget *parent = nullptr); |
| 15 |
void addPiece(const QPixmap &pixmap, const QPoint &location); |
| 16 |
|
| 17 |
static QString puzzleMimeType() { return QStringLiteral("image/x-puzzle-piece"); } |
| 18 |
|
| 19 |
protected: |
| 20 |
void dragEnterEvent(QDragEnterEvent *event) override; |
| 21 |
void dragMoveEvent(QDragMoveEvent *event) override; |
| 22 |
void dropEvent(QDropEvent *event) override; |
| 23 |
void startDrag(Qt::DropActions supportedActions) override; |
| 24 |
|
| 25 |
int m_PieceSize; |
| 26 |
}; |
| 27 |
|
| 28 |
#endif // PIECESLIST_H |