⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardsmodel.h

📁 程序代码使用说明: (1)所有源代码目录下都提供了Makefile(非Qt)
💻 H
字号:
#ifndef CARDS_MODEL_H#define CARDS_MODEL_H#include <QAbstractTableModel>#include <QList>#include <QPoint>class QColor;class QImage;class CardsModel : public QAbstractTableModel{    Q_OBJECTpublic:    CardsModel(QObject* parent = 0);    ~CardsModel();    int rowCount(const QModelIndex & = QModelIndex()) const { return ROW_NUM; }    int columnCount(const QModelIndex & = QModelIndex()) const { return COL_NUM; }    QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const;    void move(const QModelIndex &index)    { move(index.column(), index.row()); }    void move(const QPoint &index)    { move(index.x(), index.y()); }    void moveLeft();    void moveRight();    void moveUp();    void moveDown();        static const int MAX_CARDS_NUM;public slots:    void randomize();    void reset();    void showNumber(bool checked);    void saveConfig();    void loadConfig();signals:    void gameWon();    void updateMenu(bool);protected:    void initMap();    void checkwin();    void sliceImage();private:    QPoint getEmptyPoint();    void move(int col, int row);    bool moveCards(int* pCol, int* pRow);    QList<int>    mCardsList;    QList<QImage> mImages;    bool isRandomized;    bool bShowNumber;        static const QString imgName;    static const int ROW_NUM;    static const int COL_NUM;};#endif //CARDS_MODEL_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -