zoukankan      html  css  js  c++  java
  • 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;

     

    修改密码

     

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

     

    开场动画

     

     

    开场动画

     

     

  • 相关阅读:
    java 21
    maven POM.xml 标签详解
    shell sed 替代1
    lua的table库中的常用函数总结
    Lua字符串及模式匹配
    lua文件读写
    qt添加lua支持
    关于c调用lua 对‘luaL_newstate()’未定义的引用的问题解决办法
    Lua开发环境
    linux安装lua相关编译报错
  • 原文地址:https://www.cnblogs.com/tangyuanjie/p/14028242.html
Copyright © 2011-2022 走看看