• 大小: 327KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: 其他
  • 标签: qt  c++  

资源简介

用qt写的学生成绩管理系统 非常适合初学者学习

资源截图

代码片段和文件信息

#include “code.h“

Code::Code(QWidget *parent) :
    QDialog(parent)
{
    setUpSignInWidget();
    getSignInInfo();
    readStuInfo();

    account = new QLabel(“帐号  “ this);
    password = new QLabel(“密码  “ this);
    accountInput = new QLineEdit(this);
    passwordInput = new QLineEdit(this);
    enterButton = new QPushButton(“登陆“ this);
    forgotButton = new QPushButton(“忘记密码“ this);
    signInButton = new QPushButton(“注册“ this);
    teacherButton = new QRadioButton(“教师“ this);
    studentButton = new QRadioButton(“学生“ this);
    group = new QButtonGroup(this);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    QHBoxLayout *accLayout = new QHBoxLayout(this);
    QHBoxLayout *pasLayout = new QHBoxLayout(this);
    QHBoxLayout *radLayout = new QHBoxLayout(this);
    QHBoxLayout *butLayout = new QHBoxLayout(this);

    passwordInput->setEchoMode(QLineEdit::Password);
    group->addButton(teacherButton);
    group->addButton(studentButton);
    teacherButton->setChecked(true);

    accLayout->addWidget(account);
    accLayout->addWidget(accountInput);

    pasLayout->addWidget(password);
    pasLayout->addWidget(passwordInput);

    radLayout->addSpacing(50);
    radLayout->addWidget(teacherButton);
    radLayout->addWidget(studentButton);


    butLayout->addWidget(enterButton);
    butLayout->addWidget(forgotButton);
    butLayout->addWidget(signInButton);

    mainLayout->addLayout(accLayout);
    mainLayout->addLayout(pasLayout);
    mainLayout->addLayout(radLayout);
    mainLayout->addLayout(butLayout);

    setLayout(mainLayout);

    connect(enterButton SIGNAL(clicked()) this SLOT(enterSlot()));
    connect(forgotButton SIGNAL(clicked()) this SLOT(forgot()));
    connect(signInButton SIGNAL(clicked()) this SLOT(signInSlot()));
    connect(teacherButton SIGNAL(toggled(bool)) this SLOT(teacherMode()));
    connect(studentButton SIGNAL(toggled(bool)) this SLOT(studentMode()));

    setFixedSize(250 170);
}

void Code::readStuInfo()
{
    using namespace std;
    fstream file(“students“ ios_base::in);
    if (!file.is_open())
    {
        file.open(“students“ ios_base::out);
        file.close();
    }
    else
    {
        Stu temp;
        file.seekg(0 ios_base::beg);
        while(file.read((char *)&temp sizeof(Stu)))
            studentsList.append(temp);
        file.close();
    }
}

void Code::forgot()
{
    signInAccount.setText(“原帐号“);
    signInPassword.setText(“新密码“);
    signInWidget->exec();
}

void Code::teacherMode()
{
    if (!teacherButton->isChecked())
        return;

    forgotButton->setEnabled(true);
    signInButton->setEnabled(true);
    passwordInput->setEnabled(true);
    account->setText(“帐号  “);
}

void Code::studentMode()
{
    if (!studentButton->isChecked())
        return;

    forgotButton->setEnabled(false);
    signInButton->setEnabled(false);
    passwordInput->setEna

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      10916  2014-07-14 14:09  StuScoreManager\code.cpp

     文件       1196  2014-07-14 04:56  StuScoreManager\code.h

     文件        346  2014-07-14 21:01  StuScoreManager\define.h

     文件        843  2014-07-14 09:30  StuScoreManager\head.h

     文件      17938  2014-07-12 20:17  StuScoreManager\image\background.png

     文件     102716  2014-07-13 16:52  StuScoreManager\image\edit.png

     文件     101877  2014-07-13 19:39  StuScoreManager\image\new.png

     文件     101924  2014-07-13 22:27  StuScoreManager\image\saveAndExit.png

     文件        579  2016-01-26 13:08  StuScoreManager\main.cpp

     文件      34657  2014-07-14 21:01  StuScoreManager\mainwindow.cpp

     文件       2720  2014-07-14 20:50  StuScoreManager\mainwindow.h

     文件        556  2014-07-12 20:23  StuScoreManager\mainwindow.ui

     文件        227  2014-07-13 22:13  StuScoreManager\resource.qrc

     文件        441  2014-07-14 09:30  StuScoreManager\struct.h

     文件        500  2014-07-14 09:41  StuScoreManager\StuScoreManager.pro

     文件      12471  2016-02-02 14:06  StuScoreManager\StuScoreManager.pro.user

     文件      18245  2014-07-14 14:00  StuScoreManager\StuScoreManager.pro.user.e2478fd

     文件      18247  2014-07-14 12:11  StuScoreManager\StuScoreManager.pro.user.f0aebe8

     目录          0  2016-02-04 09:44  StuScoreManager\image

     目录          0  2016-02-04 09:45  StuScoreManager

----------- ---------  ---------- -----  ----

               426399                    20


评论

共有 条评论