• wobuku-ChineseChess-master【象棋】


     

     

    开场动画

     

    QSplashScreen *splash = new QSplashScreen;

    splash->setPixmap(QPixmap(":/images/成信大冬.jpg"));

    splash->show();

    for(int i=0;i<2000;i++)

    {

    splash->repaint();

    }

    splash->setPixmap(QPixmap(":/images/成信大秋.jpg"));

    splash->show();

    for(int i=0;i<2000;i++)

    {

    splash->repaint();

    }

    splash->setPixmap(QPixmap(":/images/成信大夏.jpg"));

    splash->show();

    for(int i=0;i<2000;i++)

    {

    splash->repaint();

    }

    splash->setPixmap(QPixmap(":/images/成信大春.jpg"));

    splash->show();

    for(int i=0;i<2000;i++)

    {

    splash->repaint();

    }

    delete splash;

    获取当前路径创建文件夹和文本文件

     

    #include "BuildFile.h"

    #include <QTextStream>

    #include <QDateTime>

     

     

     

    void buildFile()//建立存放数据的文件

    {

    QString infoPath = QDir::currentPath();

    infoPath = infoPath + "/info";

    QDir dirs;

    dirs.mkpath(infoPath); //创建目录

    QString name1 = infoPath + "/nickName.txt";

    QString name2 = infoPath + "/userName.txt";

    QString passWord = infoPath + "/passWord.txt";

    QString age = infoPath + "/age.txt";

    QString sex = infoPath + "/sex.txt";

    QString registTime = infoPath + "/registTime.txt";

     

    QFile file;

    //程序第一次运行时初始化数据

    if (!file.exists(name1))

    {

    QFile newFile(name1);

    newFile.open(QIODevice::WriteOnly);

    QTextStream name1IO(&newFile);

    QString model("爱编程");

    model = model + " ";

    name1IO << model;

    newFile.close();

    }

    if (!file.exists(name2))

    {

    QFile newFile(name2);

    newFile.open(QIODevice::WriteOnly);

    QTextStream name1IO(&newFile);

    name1IO << 20160000 << " ";

    newFile.close();

    }

    if (!file.exists(passWord))

    {

    QFile newFile(passWord);

    newFile.open(QIODevice::WriteOnly);

    QTextStream name1IO(&newFile);

    name1IO << "10086" << " ";

    newFile.close();

    }

    if (!file.exists(age))

    {

    QFile newFile(age);

    newFile.open(QIODevice::WriteOnly);

    QTextStream name1IO(&newFile);

    name1IO << "18" << " ";

    newFile.close();

    }

    if (!file.exists(registTime))

    {

    QFile newFile(registTime);

    newFile.open(QIODevice::WriteOnly);

    QTextStream name1IO(&newFile);

    QDateTime time = QDateTime::currentDateTime();

    QString str = time.toString("yyyy-MM-dd");

    name1IO << str << " ";

    newFile.close();

    }

    if (!file.exists(sex))

    {

    QFile newFile(sex);

    newFile.open(QIODevice::WriteOnly);

    QTextStream name1IO(&newFile);

    QString model("女");

    model = model + " ";

    name1IO << model;

    newFile.close();

    }

    }

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    注册信息记录和读取

    单独创建一个类,使用这个类记录注册信息

    读取文本文件;

     

    class infoModel : public QAbstractTableModel

    {

    Q_OBJECT

    public:

    QList<QString> nickName;

    QList<QString>::iterator iter1;

    QList<int> userName;

    QList<QString> password;

    QList<QString>::iterator iter2;

    QList<int> age;

    QList<QString> sex;

    QList<QString> registTime;

    QVector<QString> info;

     

    修改密码

     

    游戏界面(支持退后一步)

     

    开场动画

     

     

    开场动画

     

     

  • 相关阅读:
    服务器端渲染SSR的优缺点?
    Vue轻量级富文本编辑器-Vue-Quill-Editor
    浏览器跨域问题
    CSS中 !important 的使用
    如何使用vue-table-with-tree-grid的树形表格组件
    各类程序员学习路线图
    Vue中 el-table大数据量加载,不分页,节省内存的性能优化
    看完让你彻底理解 WebSocket 原理,附完整的实战代码(包含前端和后端)
    vue中class类名根据绑定的值三元表达式或字符串拼接动态添加类名
    close事件 vue_vue 监听浏览器关闭事件
  • 原文地址:https://www.cnblogs.com/tangyuanjie/p/14028242.html
Copyright © 2020-2023  润新知