• 大小: 5.01MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-19
  • 语言: 其他
  • 标签: qt5  

资源简介

采用qt5的学生成绩管理系统,包含学生成绩管理和老师成绩管理两个主要部分,

资源截图

代码片段和文件信息

#include “LoginDialog.h“
#include “ui_LoginDialog.h“
#include 
LoginDialog::LoginDialog(QWidget *parent) :
    QDialog(parent)
    ui(new Ui::LoginDialog)
{
    ui->setupUi(this);
    //创建QSqlTableModel
    model=new QSqlTableModel(this);
    model->setEditStrategy(QSqlTableModel::OnManualSubmit);
    //设置登录对话框的标题
    this->setWindowtitle(“登录“);
    //设置登录对话框的图标
    this->setWindowIcon(QIcon(“:/student/img/book.jpg“));
    //设置登录对话框大小固定为399*252
    this->setMaximumSize(399252);
    this->setMinimumSize(399252);
    //设置调色板用于设置titlelabel的颜色
    QPalette p;
    p.setColor(QPalette::WindowTextQt::black);
    ui->titlelabel->setPalette(p);
    //设置调色板用于设置logindialog的背景
    QPalette palette;
    palette.setBrush(QPalette::BackgroundQBrush(QPixmap(“:/student/img/loginbk1.jpg“).scaled(this->size())));
    this->setPalette(palette);
    //设置三个按钮的图标
    ui->exitbtn->setIcon(QIcon(“:/student/img/exit.png“));
    ui->registerbtn->setIcon(QIcon(“:/student/img/log.png“));
    ui->loginbtn->setIcon(QIcon(“:/student/img/Enter.png“));
    //设置groupbox,放置两个radiobutton
    radiogroup=new QButtonGroup(this);
    radiogroup->addButton(ui->studentradio0);
    radiogroup->addButton(ui->teacherradio1);
    //设置图片
    ui->piclabel->setPixmap(QPixmap(“:/student/img/log.png“).scaled(ui->piclabel->size()));
    //设置登录按钮不可用
    ui->loginbtn->setEnabled(false);
    //设置lineedit提示语句
    ui->userline->setPlaceholderText(“请输入用户名“);
    ui->passwordline->setPlaceholderText(“请输入密码“);
    //设置passlineedit显示为密码模式
    ui->passwordline->setEchoMode(QLineEdit::Password);
    //连接信号与槽
    connect(ui->loginbtnSIGNAL(clicked())thisSLOT(loginbtnSlot()));
    connect(ui->registerbtnSIGNAL(clicked())thisSLOT(registerbtnSlot()));
    connect(ui->exitbtnSIGNAL(clicked())thisSLOT(exitbtnSlot()));
    //设置登录按钮可用
    connect(ui->userlineSIGNAL(textChanged(QString))thisSLOT(loginbtnSetSlot(QString)));
    connect(ui->passwordlineSIGNAL(textChanged(QString))thisSLOT(loginbtnSetSlot(QString)));
}
LoginDialog::~LoginDialog()
{
    delete ui;
}
void LoginDialog::loginbtnSlot()
{
    if(!this->judgeEmpty())
    {
        ui->passwordline->clear();
        return;
    }
    //判断是否学生登录
    if(radiogroup->checkedId()==0)
    {
        model->setTable(“student“);
        model->select();
        int i;
        for(i=0;irowCount();i++)
        {
            QSqlRecord record=model->record(i);

            if(record.value(0)==ui->userline->text()&&
                    record.value(5)==ui->passwordline->text())
            {
                QString str1=“登录成功“;
                QString str2=record.value(1).toString();
                QString str3=“学生“;
                QMessageBox::information(this“提示“str3+str2+str1QMessageBox::Yes);
                this->clearAll();
                //创建学生成绩管理窗口
                student=new StudentManage;
                //连接学生成绩管理窗口和登录对话框信号与槽
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-12-08 18:02  StudentSystem\
     文件        6663  2015-12-12 01:40  StudentSystem\LoginDialog.cpp
     文件         927  2015-12-11 14:17  StudentSystem\LoginDialog.h
     文件        7926  2015-12-10 22:27  StudentSystem\LoginDialog.ui
     文件        7818  2015-12-12 01:42  StudentSystem\RegisterDialog.cpp
     文件         753  2015-12-09 10:45  StudentSystem\RegisterDialog.h
     文件        5845  2015-12-09 00:16  StudentSystem\RegisterDialog.ui
     文件        4091  2015-12-10 22:46  StudentSystem\StuInfo.cpp
     文件         791  2015-12-10 20:56  StudentSystem\StuInfo.h
     文件        4632  2015-12-11 00:29  StudentSystem\StuInfo.ui
     文件        1717  2015-12-11 13:33  StudentSystem\StuInfoSearch.cpp
     文件         626  2015-12-11 13:30  StudentSystem\StuInfoSearch.h
     文件        5045  2015-12-11 00:29  StudentSystem\StuInfoSearch.ui
     文件        4845  2015-12-10 22:46  StudentSystem\StuPassWord.cpp
     文件         714  2015-12-10 21:05  StudentSystem\StuPassWord.h
     文件        5009  2015-12-11 15:42  StudentSystem\StuPassWord.ui
     文件        5753  2015-12-11 14:48  StudentSystem\StudentManage.cpp
     文件        1190  2015-12-11 17:56  StudentSystem\StudentManage.h
     文件        7350  2015-12-11 14:17  StudentSystem\StudentManage.ui
     文件        1825  2015-12-12 13:10  StudentSystem\StudentSocre.cpp
     文件         586  2015-12-11 00:38  StudentSystem\StudentSocre.h
     文件        1711  2015-12-11 16:44  StudentSystem\StudentSocre.ui
     文件        1299  2015-12-11 21:30  StudentSystem\StudentSystem.pro
     文件       33524  2015-12-12 13:11  StudentSystem\StudentSystem.pro.user
     文件        4717  2015-12-11 22:37  StudentSystem\TeaPassWord.cpp
     文件         720  2015-12-11 22:34  StudentSystem\TeaPassWord.h
     文件        4517  2015-12-11 20:38  StudentSystem\TeaPassWord.ui
     文件        3058  2015-12-12 02:00  StudentSystem\TeacherChangeScore.cpp
     文件         744  2015-12-11 23:53  StudentSystem\TeacherChangeScore.h
     文件        2632  2015-12-11 23:57  StudentSystem\TeacherChangeScore.ui
     文件        2718  2015-12-12 01:56  StudentSystem\TeacherDelete.cpp
............此处省略62个文件信息

评论

共有 条评论