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;

     

    修改密码

     

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

     

    开场动画

     

     

    开场动画

     

     

  • 相关阅读:
    iOS Simulator功能介绍关于Xamarin IOS开发
    Unity中制作游戏的快照游戏支持玩家拍快照
    手机数据抓包入门教程
    Swift语言中为外部参数设置默认值可变参数常量参数变量参数输入输出参数
    Hierarchy视图里的Transform和Camera组件
    用JAVA编写MP3解码器——GUI(FFT)(转)
    功率W与dBm的对照表及关系(转)
    单鞭天线的长度计算方法(转)
    STM32F10X SPI操作flash MX25L64读写数据(转)
    利用STM32F唯一96bit序列号实现反拷贝加密的源代码公开(转)
  • 原文地址:https://www.cnblogs.com/tangyuanjie/p/14028242.html
Copyright © 2011-2022 走看看