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;

     

    修改密码

     

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

     

    开场动画

     

     

    开场动画

     

     

  • 相关阅读:
    字符串的长度 -- js
    导入drupal中文语言包
    ubuntu修改iP地址
    人生需要苦难和敌人
    Drupal.theme未解之谜
    如何定义带下标的js数组
    smtp admin email 似乎可以考虑在
    js中的apply 和 call
    js 点号 中括号
    代码调试
  • 原文地址:https://www.cnblogs.com/tangyuanjie/p/14028242.html
Copyright © 2011-2022 走看看