資源簡介
采用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個文件信息
評論
共有 條評論