Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef PLAYBOARDMODEL_H
- #define PLAYBOARDMODEL_H
- #include <QAbstractListModel>
- #include <QStringList>
- class Tile
- {
- public:
- Tile(int index, const int value);
- int index() const;
- int value() const;
- private:
- int m_index;
- int m_value;
- };
- class PlayBoardModel : public QAbstractListModel
- {
- Q_OBJECT
- public:
- enum TileRoles {
- IndexRole = Qt::UserRole + 1,
- ValueRole
- };
- PlayBoardModel(QObject *parent = 0);
- void appendTile(const Tile &tile);
- void shufflePlayBoard();
- int rowCount(const QModelIndex & parent = QModelIndex()) const;
- QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
- protected:
- QHash<int, QByteArray> roleNames() const;
- private:
- QList<Tile> m_tiles;
- };
- #endif // PLAYBOARDMODEL_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement