本人还只是一名大一刚刚入门编程的萌新,代码逻辑,命名肯定有各种不规范之处,还望多多担待,期待您的私信与留言,欢迎您指出我的错误,谢谢。
输入相应的IP地址,数据库账号,密码,连接MySQL。
在账号,密码栏中输入正确的账号&&密码&&选择正确的身份,点击登录可以进入相应的界面,点击退出会退出程序,设置栏中可以设置相应内容。
设置栏内有一下功能:
输入正确的账号&&正确的密码&&选择正确的身份,可以进入相应身份具有的页面,否则会报错。
重新选择正确的账号&&密码&&身份可以进入界面
管理员可以对全部的人员的账号密码进行修改,如图:
学生可以查看自己的相应成绩,如图:
教师可以修改相应的成绩,如图:
/********************************************************************************
** Form generated from reading UI file 'mainwindow.ui'
**
** Created by: Qt User Interface Compiler version 5.9.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QAction *aboutsoftware;
QAction *setdb;
QAction *aboutdb;
QAction *aboutAuthor;
QWidget *centralWidget;
QStackedWidget *stackedWidget;
QWidget *page;
QWidget *layoutWidget;
QHBoxLayout *horizontalLayout;
QLabel *ip_label;
QLabel *ipds_label;
QLabel *title_label;
QWidget *layoutWidget1;
QGridLayout *gridLayout;
QLabel *account_label;
QLineEdit *account_lineEdit;
QLabel *password_label;
QLineEdit *password_lineEdit;
QWidget *layoutWidget2;
QGridLayout *gridLayout_2;
QPushButton *login_pushButton;
QPushButton *exit_pushButton;
QLabel *notice_label;
QWidget *layoutWidget3;
QGridLayout *gridLayout_7;
QCheckBox *admin_checkBox;
QCheckBox *student_checkBox;
QCheckBox *teacher_checkBox;
QLabel *log_label;
QWidget *page_2;
QLabel *title_label_2;
QPushButton *confirm_pushButton;
QPushButton *return_pushButton;
QWidget *layoutWidget4;
QGridLayout *gridLayout_6;
QGridLayout *gridLayout_3;
QLabel *ip_label_2;
QLineEdit *ip_lineEdit;
QGridLayout *gridLayout_4;
QLabel *account_label_2;
QLineEdit *account_lineEdit_2;
QGridLayout *gridLayout_5;
QLabel *password_label_2;
QLineEdit *password_lineEdit_2;
QWidget *page_3;
QLabel *title_label_3;
QTabWidget *tabWidget;
QWidget *tab;
QTableView *admin_tableView;
QPushButton *cancel_pushButton_2;
QPushButton *add_pushButton_2;
QLineEdit *search_lineEdit_2;
QPushButton *save_pushButton_2;
QPushButton *delete_pushButton_2;
QPushButton *search_pushButton_2;
QWidget *tab_2;
QTableView *student_tableView;
QPushButton *add_pushButton_3;
QPushButton *cancel_pushButton_3;
QPushButton *delete_pushButton_3;
QPushButton *save_pushButton_3;
QLineEdit *search_lineEdit_3;
QPushButton *search_pushButton_3;
QWidget *tab_3;
QTableView *teacher_tableView;
QPushButton *add_pushButton;
QPushButton *delete_pushButton;
QLineEdit *search_lineEdit;
QPushButton *search_pushButton;
QPushButton *save_pushButton;
QPushButton *cancel_pushButton;
QWidget *layoutWidget5;
QGridLayout *gridLayout_8;
QLabel *label_2;
QLabel *welcome_label;
QLabel *show_admin_label;
QWidget *page_4;
QWidget *layoutWidget6;
QGridLayout *gridLayout_9;
QLabel *label;
QLabel *show_student_label;
QLabel *label_4;
QTableView *student_self_tableView;
QWidget *page_5;
QTableView *teacherself_tableView;
QPushButton *save_pushButton_4;
QPushButton *delete_pushButton_4;
QPushButton *search_pushButton_4;
QPushButton *cancel_pushButton_4;
QPushButton *add_pushButton_4;
QLineEdit *search_lineEdit_4;
QWidget *layoutWidget7;
QGridLayout *gridLayout_10;
QLabel *label_3;
QLabel *show_teacher_label;
QLabel *label_6;
QMenuBar *menuBar;
QMenu *menu;
QMenu *menu_2;
QToolBar *mainToolBar;
QStatusBar *statusBar;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QStringLiteral("MainWindow"));
MainWindow->resize(872, 655);
aboutsoftware = new QAction(MainWindow);
aboutsoftware->setObjectName(QStringLiteral("aboutsoftware"));
setdb = new QAction(MainWindow);
setdb->setObjectName(QStringLiteral("setdb"));
aboutdb = new QAction(MainWindow);
aboutdb->setObjectName(QStringLiteral("aboutdb"));
aboutAuthor = new QAction(MainWindow);
aboutAuthor->setObjectName(QStringLiteral("aboutAuthor"));
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName(QStringLiteral("centralWidget"));
stackedWidget = new QStackedWidget(centralWidget);
stackedWidget->setObjectName(QStringLiteral("stackedWidget"));
stackedWidget->setGeometry(QRect(10, 0, 851, 611));
page = new QWidget();
page->setObjectName(QStringLiteral("page"));
layoutWidget = new QWidget(page);
layoutWidget->setObjectName(QStringLiteral("layoutWidget"));
layoutWidget->setGeometry(QRect(10, 540, 211, 16));
horizontalLayout = new QHBoxLayout(layoutWidget);
horizontalLayout->setSpacing(6);
horizontalLayout->setContentsMargins(11, 11, 11, 11);
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
horizontalLayout->setContentsMargins(0, 0, 0, 0);
ip_label = new QLabel(layoutWidget);
ip_label->setObjectName(QStringLiteral("ip_label"));
horizontalLayout->addWidget(ip_label);
ipds_label = new QLabel(layoutWidget);
ipds_label->setObjectName(QStringLiteral("ipds_label"));
horizontalLayout->addWidget(ipds_label);
title_label = new QLabel(page);
title_label->setObjectName(QStringLiteral("title_label"));
title_label->setGeometry(QRect(280, 40, 321, 101));
layoutWidget1 = new QWidget(page);
layoutWidget1->setObjectName(QStringLiteral("layoutWidget1"));
layoutWidget1->setGeometry(QRect(520, 360, 177, 48));
gridLayout = new QGridLayout(layoutWidget1);
gridLayout->setSpacing(6);
gridLayout->setContentsMargins(11, 11, 11, 11);
gridLayout->setObjectName(QStringLiteral("gridLayout"));
gridLayout->setContentsMargins(0, 0, 0, 0);
account_label = new QLabel(layoutWidget1);
account_label->setObjectName(QStringLiteral("account_label"));
gridLayout->addWidget(account_label, 0, 0, 1, 1);
account_lineEdit = new QLineEdit(layoutWidget1);
account_lineEdit->setObjectName(QStringLiteral("account_lineEdit"));
gridLayout->addWidget(account_lineEdit, 0, 1, 1, 1);
password_label = new QLabel(layoutWidget1);
password_label->setObjectName(QStringLiteral("password_label"));
gridLayout->addWidget(password_label, 1, 0, 1, 1);
password_lineEdit = new QLineEdit(layoutWidget1);
password_lineEdit->setObjectName(QStringLiteral("password_lineEdit"));
gridLayout->addWidget(password_lineEdit, 1, 1, 1, 1);
layoutWidget2 = new QWidget(page);
layoutWidget2->setObjectName(QStringLiteral("layoutWidget2"));
layoutWidget2->setGeometry(QRect(530, 470, 158, 25));
gridLayout_2 = new QGridLayout(layoutWidget2);
gridLayout_2->setSpacing(6);
gridLayout_2->setContentsMargins(11, 11, 11, 11);
gridLayout_2->setObjectName(QStringLiteral("gridLayout_2"));
gridLayout_2->setContentsMargins(0, 0, 0, 0);
login_pushButton = new QPushButton(layoutWidget2);
login_pushButton->setObjectName(QStringLiteral("login_pushButton"));
gridLayout_2->addWidget(login_pushButton, 0, 0, 1, 1);
exit_pushButton = new QPushButton(layoutWidget2);
exit_pushButton->setObjectName(QStringLiteral("exit_pushButton"));
gridLayout_2->addWidget(exit_pushButton, 0, 1, 1, 1);
notice_label = new QLabel(page);
notice_label->setObjectName(QStringLiteral("notice_label"));
notice_label->setGeometry(QRect(60, 430, 261, 41));
layoutWidget3 = new QWidget(page);
layoutWidget3->setObjectName(QStringLiteral("layoutWidget3"));
layoutWidget3->setGeometry(QRect(120, 320, 61, 62));
gridLayout_7 = new QGridLayout(layoutWidget3);
gridLayout_7->setSpacing(6);
gridLayout_7->setContentsMargins(11, 11, 11, 11);
gridLayout_7->setObjectName(QStringLiteral("gridLayout_7"));
gridLayout_7->setContentsMargins(0, 0, 0, 0);
admin_checkBox = new QCheckBox(layoutWidget3);
admin_checkBox->setObjectName(QStringLiteral("admin_checkBox"));
gridLayout_7->addWidget(admin_checkBox, 0, 0, 1, 1);
student_checkBox = new QCheckBox(layoutWidget3);
student_checkBox->setObjectName(QStringLiteral("student_checkBox"));
gridLayout_7->addWidget(student_checkBox, 1, 0, 1, 1);
teacher_checkBox = new QCheckBox(layoutWidget3);
teacher_checkBox->setObjectName(QStringLiteral("teacher_checkBox"));
gridLayout_7->addWidget(teacher_checkBox, 2, 0, 1, 1);
log_label = new QLabel(page);
log_label->setObjectName(QStringLiteral("log_label"));
log_label->setGeometry(QRect(240, 60, 361, 131));
log_label->setPixmap(QPixmap(QString::fromUtf8("C:/Users/\345\275\255\346\263\275\347\221\204/Desktop/logo.png")));
stackedWidget->addWidget(page);
page_2 = new QWidget();
page_2->setObjectName(QStringLiteral("page_2"));
title_label_2 = new QLabel(page_2);
title_label_2->setObjectName(QStringLiteral("title_label_2"));
title_label_2->setGeometry(QRect(340, 70, 141, 61));
confirm_pushButton = new QPushButton(page_2);
confirm_pushButton->setObjectName(QStringLiteral("confirm_pushButton"));
confirm_pushButton->setGeometry(QRect(520, 520, 75, 23));
return_pushButton = new QPushButton(page_2);
return_pushButton->setObjectName(QStringLiteral("return_pushButton"));
return_pushButton->setGeometry(QRect(660, 520, 75, 23));
layoutWidget4 = new QWidget(page_2);
layoutWidget4->setObjectName(QStringLiteral("layoutWidget4"));
layoutWidget4->setGeometry(QRect(530, 370, 215, 80));
gridLayout_6 = new QGridLayout(layoutWidget4);
gridLayout_6->setSpacing(6);
gridLayout_6->setContentsMargins(11, 11, 11, 11);
gridLayout_6->setObjectName(QStringLiteral("gridLayout_6"));
gridLayout_6->setContentsMargins(0, 0, 0, 0);
gridLayout_3 = new QGridLayout();
gridLayout_3->setSpacing(6);
gridLayout_3->setObjectName(QStringLiteral("gridLayout_3"));
ip_label_2 = new QLabel(layoutWidget4);
ip_label_2->setObjectName(QStringLiteral("ip_label_2"));
gridLayout_3->addWidget(ip_label_2, 0, 0, 1, 1);
ip_lineEdit = new QLineEdit(layoutWidget4);
ip_lineEdit->setObjectName(QStringLiteral("ip_lineEdit"));
gridLayout_3->addWidget(ip_lineEdit, 0, 1, 1, 1);
gridLayout_6->addLayout(gridLayout_3, 0, 0, 1, 1);
gridLayout_4 = new QGridLayout();
gridLayout_4->setSpacing(6);
gridLayout_4->setObjectName(QStringLiteral("gridLayout_4"));
account_label_2 = new QLabel(layoutWidget4);
account_label_2->setObjectName(QStringLiteral("account_label_2"));
gridLayout_4->addWidget(account_label_2, 0, 0, 1, 1);
account_lineEdit_2 = new QLineEdit(layoutWidget4);
account_lineEdit_2->setObjectName(QStringLiteral("account_lineEdit_2"));
gridLayout_4->addWidget(account_lineEdit_2, 0, 1, 1, 1);
gridLayout_6->addLayout(gridLayout_4, 1, 0, 1, 1);
gridLayout_5 = new QGridLayout();
gridLayout_5->setSpacing(6);
gridLayout_5->setObjectName(QStringLiteral("gridLayout_5"));
password_label_2 = new QLabel(layoutWidget4);
password_label_2->setObjectName(QStringLiteral("password_label_2"));
gridLayout_5->addWidget(password_label_2, 0, 0, 1, 1);
password_lineEdit_2 = new QLineEdit(layoutWidget4);
password_lineEdit_2->setObjectName(QStringLiteral("password_lineEdit_2"));
gridLayout_5->addWidget(password_lineEdit_2, 0, 1, 1, 1);
gridLayout_6->addLayout(gridLayout_5, 2, 0, 1, 1);
stackedWidget->addWidget(page_2);
page_3 = new QWidget();
page_3->setObjectName(QStringLiteral("page_3"));
title_label_3 = new QLabel(page_3);
title_label_3->setObjectName(QStringLiteral("title_label_3"));
title_label_3->setGeometry(QRect(340, 0, 131, 71));
tabWidget = new QTabWidget(page_3);
tabWidget->setObjectName(QStringLiteral("tabWidget"));
tabWidget->setGeometry(QRect(0, 30, 851, 551));
tab = new QWidget();
tab->setObjectName(QStringLiteral("tab"));
admin_tableView = new QTableView(tab);
admin_tableView->setObjectName(QStringLiteral("admin_tableView"));
admin_tableView->setGeometry(QRect(10, 10, 831, 441));
cancel_pushButton_2 = new QPushButton(tab);
cancel_pushButton_2->setObjectName(QStringLiteral("cancel_pushButton_2"));
cancel_pushButton_2->setGeometry(QRect(720, 490, 75, 23));
add_pushButton_2 = new QPushButton(tab);
add_pushButton_2->setObjectName(QStringLiteral("add_pushButton_2"));
add_pushButton_2->setGeometry(QRect(60, 460, 75, 23));
search_lineEdit_2 = new QLineEdit(tab);
search_lineEdit_2->setObjectName(QStringLiteral("search_lineEdit_2"));
search_lineEdit_2->setGeometry(QRect(180, 470, 391, 20));
save_pushButton_2 = new QPushButton(tab);
save_pushButton_2->setObjectName(QStringLiteral("save_pushButton_2"));
save_pushButton_2->setGeometry(QRect(720, 460, 75, 23));
delete_pushButton_2 = new QPushButton(tab);
delete_pushButton_2->setObjectName(QStringLiteral("delete_pushButton_2"));
delete_pushButton_2->setGeometry(QRect(60, 490, 75, 23));
search_pushButton_2 = new QPushButton(tab);
search_pushButton_2->setObjectName(QStringLiteral("search_pushButton_2"));
search_pushButton_2->setGeometry(QRect(590, 470, 75, 23));
tabWidget->addTab(tab, QString());
tab_2 = new QWidget();
tab_2->setObjectName(QStringLiteral("tab_2"));
student_tableView = new QTableView(tab_2);
student_tableView->setObjectName(QStringLiteral("student_tableView"));
student_tableView->setGeometry(QRect(0, 0, 841, 461));
add_pushButton_3 = new QPushButton(tab_2);
add_pushButton_3->setObjectName(QStringLiteral("add_pushButton_3"));
add_pushButton_3->setGeometry(QRect(60, 470, 75, 23));
cancel_pushButton_3 = new QPushButton(tab_2);
cancel_pushButton_3->setObjectName(QStringLiteral("cancel_pushButton_3"));
cancel_pushButton_3->setGeometry(QRect(720, 500, 75, 23));
delete_pushButton_3 = new QPushButton(tab_2);
delete_pushButton_3->setObjectName(QStringLiteral("delete_pushButton_3"));
delete_pushButton_3->setGeometry(QRect(60, 500, 75, 23));
save_pushButton_3 = new QPushButton(tab_2);
save_pushButton_3->setObjectName(QStringLiteral("save_pushButton_3"));
save_pushButton_3->setGeometry(QRect(720, 470, 75, 23));
search_lineEdit_3 = new QLineEdit(tab_2);
search_lineEdit_3->setObjectName(QStringLiteral("search_lineEdit_3"));
search_lineEdit_3->setGeometry(QRect(180, 480, 391, 20));
search_pushButton_3 = new QPushButton(tab_2);
search_pushButton_3->setObjectName(QStringLiteral("search_pushButton_3"));
search_pushButton_3->setGeometry(QRect(590, 480, 75, 23));
tabWidget->addTab(tab_2, QString());
tab_3 = new QWidget();
tab_3->setObjectName(QStringLiteral("tab_3"));
teacher_tableView = new QTableView(tab_3);
teacher_tableView->setObjectName(QStringLiteral("teacher_tableView"));
teacher_tableView->setGeometry(QRect(5, 1, 831, 431));
add_pushButton = new QPushButton(tab_3);
add_pushButton->setObjectName(QStringLiteral("add_pushButton"));
add_pushButton->setGeometry(QRect(20, 450, 75, 23));
delete_pushButton = new QPushButton(tab_3);
delete_pushButton->setObjectName(QStringLiteral("delete_pushButton"));
delete_pushButton->setGeometry(QRect(20, 480, 75, 23));
search_lineEdit = new QLineEdit(tab_3);
search_lineEdit->setObjectName(QStringLiteral("search_lineEdit"));
search_lineEdit->setGeometry(QRect(140, 460, 391, 20));
search_pushButton = new QPushButton(tab_3);
search_pushButton->setObjectName(QStringLiteral("search_pushButton"));
search_pushButton->setGeometry(QRect(550, 460, 75, 23));
save_pushButton = new QPushButton(tab_3);
save_pushButton->setObjectName(QStringLiteral("save_pushButton"));
save_pushButton->setGeometry(QRect(680, 450, 75, 23));
cancel_pushButton = new QPushButton(tab_3);
cancel_pushButton->setObjectName(QStringLiteral("cancel_pushButton"));
cancel_pushButton->setGeometry(QRect(680, 480, 75, 23));
tabWidget->addTab(tab_3, QString());
layoutWidget5 = new QWidget(page_3);
layoutWidget5->setObjectName(QStringLiteral("layoutWidget5"));
layoutWidget5->setGeometry(QRect(0, 580, 191, 16));
gridLayout_8 = new QGridLayout(layoutWidget5);
gridLayout_8->setSpacing(6);
gridLayout_8->setContentsMargins(11, 11, 11, 11);
gridLayout_8->setObjectName(QStringLiteral("gridLayout_8"));
gridLayout_8->setContentsMargins(0, 0, 0, 0);
label_2 = new QLabel(layoutWidget5);
label_2->setObjectName(QStringLiteral("label_2"));
gridLayout_8->addWidget(label_2, 0, 3, 1, 1);
welcome_label = new QLabel(layoutWidget5);
welcome_label->setObjectName(QStringLiteral("welcome_label"));
gridLayout_8->addWidget(welcome_label, 0, 0, 1, 1);
show_admin_label = new QLabel(layoutWidget5);
show_admin_label->setObjectName(QStringLiteral("show_admin_label"));
gridLayout_8->addWidget(show_admin_label, 0, 2, 1, 1);
stackedWidget->addWidget(page_3);
page_4 = new QWidget();
page_4->setObjectName(QStringLiteral("page_4"));
layoutWidget6 = new QWidget(page_4);
layoutWidget6->setObjectName(QStringLiteral("layoutWidget6"));
layoutWidget6->setGeometry(QRect(0, 580, 152, 14));
gridLayout_9 = new QGridLayout(layoutWidget6);
gridLayout_9->setSpacing(6);
gridLayout_9->setContentsMargins(11, 11, 11, 11);
gridLayout_9->setObjectName(QStringLiteral("gridLayout_9"));
gridLayout_9->setContentsMargins(0, 0, 0, 0);
label = new QLabel(layoutWidget6);
label->setObjectName(QStringLiteral("label"));
gridLayout_9->addWidget(label, 0, 0, 1, 1);
show_student_label = new QLabel(layoutWidget6);
show_student_label->setObjectName(QStringLiteral("show_student_label"));
gridLayout_9->addWidget(show_student_label, 0, 1, 1, 1);
label_4 = new QLabel(layoutWidget6);
label_4->setObjectName(QStringLiteral("label_4"));
gridLayout_9->addWidget(label_4, 0, 2, 1, 1);
student_self_tableView = new QTableView(page_4);
student_self_tableView->setObjectName(QStringLiteral("student_self_tableView"));
student_self_tableView->setGeometry(QRect(0, 10, 861, 571));
stackedWidget->addWidget(page_4);
page_5 = new QWidget();
page_5->setObjectName(QStringLiteral("page_5"));
teacherself_tableView = new QTableView(page_5);
teacherself_tableView->setObjectName(QStringLiteral("teacherself_tableView"));
teacherself_tableView->setGeometry(QRect(0, 0, 861, 521));
save_pushButton_4 = new QPushButton(page_5);
save_pushButton_4->setObjectName(QStringLiteral("save_pushButton_4"));
save_pushButton_4->setGeometry(QRect(700, 520, 75, 23));
delete_pushButton_4 = new QPushButton(page_5);
delete_pushButton_4->setObjectName(QStringLiteral("delete_pushButton_4"));
delete_pushButton_4->setGeometry(QRect(40, 550, 75, 23));
search_pushButton_4 = new QPushButton(page_5);
search_pushButton_4->setObjectName(QStringLiteral("search_pushButton_4"));
search_pushButton_4->setGeometry(QRect(570, 530, 75, 23));
cancel_pushButton_4 = new QPushButton(page_5);
cancel_pushButton_4->setObjectName(QStringLiteral("cancel_pushButton_4"));
cancel_pushButton_4->setGeometry(QRect(700, 550, 75, 23));
add_pushButton_4 = new QPushButton(page_5);
add_pushButton_4->setObjectName(QStringLiteral("add_pushButton_4"));
add_pushButton_4->setGeometry(QRect(40, 520, 75, 23));
search_lineEdit_4 = new QLineEdit(page_5);
search_lineEdit_4->setObjectName(QStringLiteral("search_lineEdit_4"));
search_lineEdit_4->setGeometry(QRect(160, 530, 391, 20));
layoutWidget7 = new QWidget(page_5);
layoutWidget7->setObjectName(QStringLiteral("layoutWidget7"));
layoutWidget7->setGeometry(QRect(0, 580, 152, 14));
gridLayout_10 = new QGridLayout(layoutWidget7);
gridLayout_10->setSpacing(6);
gridLayout_10->setContentsMargins(11, 11, 11, 11);
gridLayout_10->setObjectName(QStringLiteral("gridLayout_10"));
gridLayout_10->setContentsMargins(0, 0, 0, 0);
label_3 = new QLabel(layoutWidget7);
label_3->setObjectName(QStringLiteral("label_3"));
gridLayout_10->addWidget(label_3, 0, 0, 1, 1);
show_teacher_label = new QLabel(layoutWidget7);
show_teacher_label->setObjectName(QStringLiteral("show_teacher_label"));
gridLayout_10->addWidget(show_teacher_label, 0, 1, 1, 1);
label_6 = new QLabel(layoutWidget7);
label_6->setObjectName(QStringLiteral("label_6"));
gridLayout_10->addWidget(label_6, 0, 2, 1, 1);
stackedWidget->addWidget(page_5);
MainWindow->setCentralWidget(centralWidget);
menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QStringLiteral("menuBar"));
menuBar->setGeometry(QRect(0, 0, 872, 23));
menu = new QMenu(menuBar);
menu->setObjectName(QStringLiteral("menu"));
menu_2 = new QMenu(menu);
menu_2->setObjectName(QStringLiteral("menu_2"));
MainWindow->setMenuBar(menuBar);
mainToolBar = new QToolBar(MainWindow);
mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QStringLiteral("statusBar"));
MainWindow->setStatusBar(statusBar);
menuBar->addAction(menu->menuAction());
menu->addAction(menu_2->menuAction());
menu->addAction(aboutsoftware);
menu->addSeparator();
menu->addAction(aboutAuthor);
menu_2->addAction(setdb);
menu_2->addAction(aboutdb);
retranslateUi(MainWindow);
stackedWidget->setCurrentIndex(1);
tabWidget->setCurrentIndex(1);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", Q_NULLPTR));
aboutsoftware->setText(QApplication::translate("MainWindow", "\345\205\263\344\272\216\346\234\254\347\250\213\345\272\217", Q_NULLPTR));
setdb->setText(QApplication::translate("MainWindow", "\346\225\260\346\215\256\345\272\223\350\256\276\347\275\256", Q_NULLPTR));
aboutdb->setText(QApplication::translate("MainWindow", "\345\205\263\344\272\216\346\225\260\346\215\256\345\272\223", Q_NULLPTR));
aboutAuthor->setText(QApplication::translate("MainWindow", "\345\205\263\344\272\216\344\275\234\350\200\205", Q_NULLPTR));
ip_label->setText(QApplication::translate("MainWindow", "\345\275\223\345\211\215\346\225\260\346\215\256\345\272\223IP\357\274\232", Q_NULLPTR));
ipds_label->setText(QApplication::translate("MainWindow", "TextLabel", Q_NULLPTR));
title_label->setText(QApplication::translate("MainWindow", "\350\276\275\345\256\201\347\247\221\346\212\200\345\244\247\345\255\246\346\240\241\345\233\255\347\256\241\347\220\206\347\263\273\347\273\237
", Q_NULLPTR));
account_label->setText(QApplication::translate("MainWindow", "\350\264\246\345\217\267\357\274\232", Q_NULLPTR));
password_label->setText(QApplication::translate("MainWindow", "\345\257\206\347\240\201\357\274\232", Q_NULLPTR));
login_pushButton->setText(QApplication::translate("MainWindow", "\347\231\273\345\275\225", Q_NULLPTR));
exit_pushButton->setText(QApplication::translate("MainWindow", "\351\200\200\345\207\272", Q_NULLPTR));
notice_label->setText(QApplication::translate("MainWindow", "\346\263\250\346\204\217\350\257\267\350\276\223\345\205\245\350\264\246\345\217\267\345\222\214\345\257\206\347\240\201\345\220\216\351\200\211\346\213\251\350\272\253\344\273\275!
", Q_NULLPTR));
admin_checkBox->setText(QApplication::translate("MainWindow", "\347\256\241\347\220\206\345\221\230", Q_NULLPTR));
student_checkBox->setText(QApplication::translate("MainWindow", "\345\255\246\347\224\237", Q_NULLPTR));
teacher_checkBox->setText(QApplication::translate("MainWindow", "\346\225\231\345\270\210", Q_NULLPTR));
log_label->setText(QString());
title_label_2->setText(QApplication::translate("MainWindow", "\350\256\276\347\275\256\346\234\215\345\212\241\345\231\250
", Q_NULLPTR));
confirm_pushButton->setText(QApplication::translate("MainWindow", "\347\241\256\350\256\244", Q_NULLPTR));
return_pushButton->setText(QApplication::translate("MainWindow", "\350\277\224\345\233\236", Q_NULLPTR));
ip_label_2->setText(QApplication::translate("MainWindow", "\346\225\260\346\215\256\345\272\223IP\357\274\232", Q_NULLPTR));
ip_lineEdit->setText(QApplication::translate("MainWindow", "127.0.0.", Q_NULLPTR));
account_label_2->setText(QApplication::translate("MainWindow", "\346\225\260\346\215\256\345\272\223\350\264\246\345\217\267\357\274\232", Q_NULLPTR));
account_lineEdit_2->setText(QApplication::translate("MainWindow", "roo", Q_NULLPTR));
password_label_2->setText(QApplication::translate("MainWindow", "\346\225\260\346\215\256\345\272\223\345\257\206\347\240\201\357\274\232", Q_NULLPTR));
password_lineEdit_2->setText(QApplication::translate("MainWindow", "123123", Q_NULLPTR));
title_label_3->setText(QApplication::translate("MainWindow", "\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242
", Q_NULLPTR));
cancel_pushButton_2->setText(QApplication::translate("MainWindow", "\346\222\244\351\224\200", Q_NULLPTR));
add_pushButton_2->setText(QApplication::translate("MainWindow", "\345\242\236\345\212\240", Q_NULLPTR));
save_pushButton_2->setText(QApplication::translate("MainWindow", "\344\277\235\345\255\230", Q_NULLPTR));
delete_pushButton_2->setText(QApplication::translate("MainWindow", "\345\210\240\351\231\244", Q_NULLPTR));
search_pushButton_2->setText(QApplication::translate("MainWindow", "\346\237\245\346\211\276", Q_NULLPTR));
tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("MainWindow", "\347\256\241\347\220\206\345\221\230\346\225\260\346\215\256\345\272\223", Q_NULLPTR));
add_pushButton_3->setText(QApplication::translate("MainWindow", "\345\242\236\345\212\240", Q_NULLPTR));
cancel_pushButton_3->setText(QApplication::translate("MainWindow", "\346\222\244\351\224\200", Q_NULLPTR));
delete_pushButton_3->setText(QApplication::translate("MainWindow", "\345\210\240\351\231\244", Q_NULLPTR));
save_pushButton_3->setText(QApplication::translate("MainWindow", "\344\277\235\345\255\230", Q_NULLPTR));
search_pushButton_3->setText(QApplication::translate("MainWindow", "\346\237\245\346\211\276", Q_NULLPTR));
tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("MainWindow", "\345\255\246\347\224\237\346\225\260\346\215\256\345\272\223", Q_NULLPTR));
add_pushButton->setText(QApplication::translate("MainWindow", "\345\242\236\345\212\240", Q_NULLPTR));
delete_pushButton->setText(QApplication::translate("MainWindow", "\345\210\240\351\231\244", Q_NULLPTR));
search_pushButton->setText(QApplication::translate("MainWindow", "\346\237\245\346\211\276", Q_NULLPTR));
save_pushButton->setText(QApplication::translate("MainWindow", "\344\277\235\345\255\230", Q_NULLPTR));
cancel_pushButton->setText(QApplication::translate("MainWindow", "\346\222\244\351\224\200", Q_NULLPTR));
tabWidget->setTabText(tabWidget->indexOf(tab_3), QApplication::translate("MainWindow", "\346\225\231\345\270\210\346\225\260\346\215\256\345\272\223", Q_NULLPTR));
label_2->setText(QApplication::translate("MainWindow", "\347\256\241\347\220\206\345\221\230\347\231\273\345\275\225", Q_NULLPTR));
welcome_label->setText(QApplication::translate("MainWindow", "\346\254\242\350\277\216\357\274\232", Q_NULLPTR));
show_admin_label->setText(QApplication::translate("MainWindow", "TextLabel", Q_NULLPTR));
label->setText(QApplication::translate("MainWindow", "\346\254\242\350\277\216\357\274\232", Q_NULLPTR));
show_student_label->setText(QApplication::translate("MainWindow", "TextLabel", Q_NULLPTR));
label_4->setText(QApplication::translate("MainWindow", "\345\220\214\345\255\246\347\231\273\345\275\225", Q_NULLPTR));
save_pushButton_4->setText(QApplication::translate("MainWindow", "\344\277\235\345\255\230", Q_NULLPTR));
delete_pushButton_4->setText(QApplication::translate("MainWindow", "\345\210\240\351\231\244", Q_NULLPTR));
search_pushButton_4->setText(QApplication::translate("MainWindow", "\346\237\245\346\211\276", Q_NULLPTR));
cancel_pushButton_4->setText(QApplication::translate("MainWindow", "\346\222\244\351\224\200", Q_NULLPTR));
add_pushButton_4->setText(QApplication::translate("MainWindow", "\345\242\236\345\212\240", Q_NULLPTR));
label_3->setText(QApplication::translate("MainWindow", "\346\254\242\350\277\216\357\274\232", Q_NULLPTR));
show_teacher_label->setText(QApplication::translate("MainWindow", "TextLabel", Q_NULLPTR));
label_6->setText(QApplication::translate("MainWindow", "\350\200\201\345\270\210\347\231\273\345\275\225", Q_NULLPTR));
menu->setTitle(QApplication::translate("MainWindow", "\350\256\276\347\275\256", Q_NULLPTR));
menu_2->setTitle(QApplication::translate("MainWindow", "\346\225\260\346\215\256\345\272\223", Q_NULLPTR));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include
#include
#include
#include
#include
#include
#include"QSqlQuery"
#include
#include
#include
#include
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui; //UI
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); //设置数据库
QString db_ip; //数据库IP
QString db_Databasename = "login";//数据库名称
QString db_Username;//USER_NAME
QString db_Password;//PASSWORD
QString user_name;
QString user_password;
QString cmd;//SQL语句
int flag = 0;//控制多选项
QSqlTableModel* admin_model;//相应的modele
QSqlTableModel* student_model;
QSqlTableModel* teacher_model;
QSqlTableModel* studentself_model;
QSqlTableModel* teacherself_model;
private slots:
void OpenAboutSoftWare(); //菜单关于本程序按钮
void OpenAboutDb();//打开关于数据库
void OpenAboutAuthor();//关于作者
void setDataBase();//设置数据库
void on_exit_pushButton_clicked();//退出按钮
void on_login_pushButton_clicked();//登录
void on_return_pushButton_clicked();//确认
void on_confirm_pushButton_clicked();
void on_admin_checkBox_clicked();//admin选项
void on_student_checkBox_clicked();//student选项
void on_teacher_checkBox_clicked();//teacher选项
/*下方是相应界面的操作代码*/
void on_add_pushButton_clicked();
void on_save_pushButton_clicked();
void on_cancel_pushButton_clicked();
void on_delete_pushButton_clicked();
void on_search_pushButton_clicked();
void on_add_pushButton_2_clicked();
void on_save_pushButton_2_clicked();
void on_cancel_pushButton_2_clicked();
void on_delete_pushButton_2_clicked();
void on_search_pushButton_2_clicked();
void on_add_pushButton_3_clicked();
void on_save_pushButton_3_clicked();
void on_cancel_pushButton_3_clicked();
void on_delete_pushButton_3_clicked();
void on_search_pushButton_3_clicked();
void on_add_pushButton_4_clicked();
void on_save_pushButton_4_clicked();
void on_cancel_pushButton_4_clicked();
void on_delete_pushButton_4_clicked();
void on_search_pushButton_4_clicked();
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent):QMainWindow(parent),ui(new Ui::MainWindow) //init
{
ui->setupUi(this);
this->ui->ipds_label->setText(this->db_ip);
connect(this->ui->aboutsoftware,&QAction::triggered,this,this->OpenAboutSoftWare); //关于软件
connect(this->ui->aboutdb,&QAction::triggered,this,this->OpenAboutDb); //关于数据库
connect(this->ui->aboutAuthor,&QAction::triggered,this,this->OpenAboutAuthor); //关于作者
connect(this->ui->setdb,&QAction::triggered,this,this->setDataBase); //设置数据库
this->db_ip = this->ui->ip_lineEdit->text();//从IP_LINEEDIT 中获取ip
this->db_Username = this->ui->account_lineEdit_2->text();//从LINEEDIT中获取USERNAME
this->db_Password = this->ui->password_lineEdit_2->text();//从LINEEDIT中获取PASSWORD
/*数据库相关*/
this->ui->ipds_label->setText(this->db_ip);
this->db.setHostName(this->db_ip);
this->db.setDatabaseName(this->db_Databasename);
this->db.setUserName(this->db_Username);
this->db.setPassword(this->db_Password);
//对数据库连接情况进行判断
if(!(this->db.open()))
{
QMessageBox::warning(nullptr,"错误!",db.lastError().text());
this->ui->stackedWidget->setCurrentIndex(1); //切换界面至设置数据库界面
}
else
{
QMessageBox::about(nullptr,"连接成功!","数据库已经成功连接!");//显示连接成功
}
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::OpenAboutSoftWare()//打开关于本程序
{
QMessageBox::about(nullptr,"关于本软件","本程序是一个对校园进行管理的简易系统本程序使用Qt框架结合C++语言进行设计,结合MySQL搭建数据库。本程序仅供实验使用。
");
}
void MainWindow::OpenAboutDb()//关于数据库
{
QMessageBox::about(nullptr,"关于数据库","本软件服务器搭建于Raspberry pi 3b+(Linux)系统,数据库使用MySQL
默认IP地址:127.0.0.1 (localhost)
默认用户名:root
默认密码:123123
");
}
void MainWindow::OpenAboutAuthor()//关于作者
{
QMessageBox::about(nullptr,"关于作者","辽宁科技大学 PureAngel");
}
void MainWindow::setDataBase() //切换界面
{
//SetDataBase*ptr_db = new SetDataBase(this->db);
//ptr_db->show();
this->ui->stackedWidget->setCurrentIndex(1);
}
void MainWindow::on_exit_pushButton_clicked() // 退出程序
{
this->close();
}
void MainWindow::on_login_pushButton_clicked()//登录
{
QSqlQuery query;
query.exec(this->cmd);//录入SQL
if(query.first()) //登录成功
{
QMessageBox::information(nullptr,"登录成功","欢迎登录!",QMessageBox::Yes);//显示成功
//switch (this->flag)
//{
//case 1:
// this->ui->stackedWidget->setCurrentIndex(2);
// break;
// case 2:
// this->ui->stackedWidget->setCurrentIndex(3);
// break;
// case 3:
// this->ui->stackedWidget->setCurrentIndex(4);
// break;
//default:
// break;
// }
if(this->flag == 1) //admin界面
{
this->ui->stackedWidget->setCurrentIndex(2);//切换至admin界面
/*管理员的数据库显示*/
this->admin_model = new QSqlTableModel(this);
this->admin_model->setTable("admin"); //选择数据库
this->ui->admin_tableView->setModel(this->admin_model); //显示出相应内容
this->admin_model->select();//全部显示
/*学生的数据库显示*/
this->student_model = new QSqlTableModel(this);
this->student_model->setTable("student");
this->ui->student_tableView->setModel(this->student_model);
this->student_model->select();
/*教师*/
this->teacher_model = new QSqlTableModel(this);
this->teacher_model->setTable("teacher");
this->ui->teacher_tableView->setModel(this->teacher_model);
this->teacher_model->select();
/*设置数据库显示相关*/
this->admin_model->setHeaderData(0,Qt::Horizontal,"账号");
this->admin_model->setHeaderData(1,Qt::Horizontal,"密码");
this->student_model->setHeaderData(0,Qt::Horizontal,"账号");
this->student_model->setHeaderData(1,Qt::Horizontal,"密码");
this->teacher_model->setHeaderData(0,Qt::Horizontal,"账号");
this->teacher_model->setHeaderData(1,Qt::Horizontal,"密码");
/*设置手动提交,防止误操作*/
this->admin_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
this->student_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
this->teacher_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
}
else
if(this->flag == 2)
{
this->ui->stackedWidget->setCurrentIndex(3);
this->studentself_model = new QSqlTableModel(this);
this->studentself_model->setTable("student_score");//选择数据库
this->ui->student_self_tableView->setModel(this->studentself_model);
/*显示自身的成绩*/
QString str = QString("Name = '%1' ").arg(this->ui->account_lineEdit->text());
this->studentself_model->setFilter(str);
this->studentself_model->select();
this->ui->student_self_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);//不允许进行编辑、修改
this->studentself_model->setHeaderData(0,Qt::Horizontal,"姓名");
this->studentself_model->setHeaderData(1,Qt::Horizontal,"高等数学");
this->studentself_model->setHeaderData(2,Qt::Horizontal,"大学物理");
this->studentself_model->setHeaderData(3,Qt::Horizontal,"大学英语");
this->studentself_model->setHeaderData(4,Qt::Horizontal,"数据结构");
}
else
if(this->flag == 3)
{
this->ui->stackedWidget->setCurrentIndex(4);
this->teacherself_model = new QSqlTableModel(this);
this->teacherself_model->setTable("student_score");
this->ui->teacherself_tableView->setModel(this->teacherself_model);
this->teacherself_model->select();
this->teacherself_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
this->teacherself_model->setHeaderData(0,Qt::Horizontal,"姓名");
this->teacherself_model->setHeaderData(1,Qt::Horizontal,"高等数学");
this->teacherself_model->setHeaderData(2,Qt::Horizontal,"大学物理");
this->teacherself_model->setHeaderData(3,Qt::Horizontal,"大学英语");
this->teacherself_model->setHeaderData(4,Qt::Horizontal,"数据结构");
}
}
else
{
QMessageBox::warning(nullptr,"Error!","登录失败,请输入正确的账号和密码!");//登录失败、报错
}
}
void MainWindow::on_return_pushButton_clicked()
{
this->ui->stackedWidget->setCurrentIndex(0);
}
void MainWindow::on_confirm_pushButton_clicked() //连接数据库相关
{
this->db_ip = this->ui->ip_lineEdit->text();
this->db_Username = this->ui->account_lineEdit_2->text();
this->db_Password = this->ui->password_lineEdit_2->text();
this->db.setHostName(this->db_ip);
this->db.setDatabaseName(this->db_Databasename);
this->db.setUserName(this->db_Username);
this->db.setPassword(this->db_Password);
if(!(this->db.open()))
{
QMessageBox::warning(nullptr,"错误!",db.lastError().text());
this->ui->stackedWidget->setCurrentIndex(1);
}
else
{
QMessageBox::about(nullptr,"连接成功!","数据库已经成功连接!");
this->ui->ipds_label->setText(this->db_ip);
this->ui->stackedWidget->setCurrentIndex(0);
}
}
void MainWindow::on_admin_checkBox_clicked() //选择admin时
{
this->user_name = this->ui->account_lineEdit->text();
this->user_password = this->ui->password_lineEdit->text();
this->cmd = QString("select * from admin where username = '%1' and password = '%2'").arg(this->user_name).arg(this->user_password); //生成SQL
//qDebug()<cmd<
this->ui->show_admin_label->setText(this->user_name);//切换标签
this->flag = 1;//设置flag
}
void MainWindow::on_student_checkBox_clicked()//选择student时
{
this->user_name = this->ui->account_lineEdit->text();
this->user_password = this->ui->password_lineEdit->text();
this->cmd = QString("select * from student where username = '%1' and password = '%2'").arg(this->user_name).arg(this->user_password);//生成SQL
qDebug()<<this->cmd<<endl;
this->ui->show_student_label->setText(this->user_name);//切换标签
this->flag = 2;//设置flag
//qDebug()<flag;
}
void MainWindow::on_teacher_checkBox_clicked()//选择教师时
{
this->user_name = this->ui->account_lineEdit->text();
this->user_password = this->ui->password_lineEdit->text();
this->cmd = QString("select * from teacher where username = '%1' and password = '%2'").arg(this->user_name).arg(this->user_password);//生成SQL
//qDebug()<cmd<
this->ui->show_teacher_label->setText(this->user_name);//切换标签
this->flag = 3;//设置flag
}
void MainWindow::on_add_pushButton_clicked() //添加空行
{
QSqlRecord record = this->teacher_model->record();
int row = this->teacher_model->rowCount();//获取行数
this->teacher_model->insertRecord(row,record);//插入
}
void MainWindow::on_save_pushButton_clicked()
{
this->teacher_model->submitAll();//点击保存后提交SQL
}
void MainWindow::on_cancel_pushButton_clicked()
{
this->teacher_model->revertAll();
this->teacher_model->submitAll();
}
void MainWindow::on_delete_pushButton_clicked()
{
QItemSelectionModel* select = this->ui->teacher_tableView->selectionModel();
QModelIndexList list = select->selectedRows();
for(int i = 0 ; i < list.size() ; i++ )
{
this->teacher_model->removeRow(list.at(i).row());
}
}
void MainWindow::on_search_pushButton_clicked()
{
QString name = this->ui->search_lineEdit->text();
if(!(name == '#'))
{
QString str = QString("username = '%1' ").arg(name);
this->teacher_model->setFilter(str);
this->teacher_model->select();
}
else
{
this->teacher_model->select();
}
}
void MainWindow::on_add_pushButton_2_clicked()
{
QSqlRecord record = this->admin_model->record();
int row = this->admin_model->rowCount();
this->admin_model->insertRecord(row,record);
}
void MainWindow::on_save_pushButton_2_clicked()
{
this->admin_model->submitAll();
}
void MainWindow::on_cancel_pushButton_2_clicked()
{
this->admin_model->revertAll();
this->admin_model->submitAll();
}
void MainWindow::on_delete_pushButton_2_clicked()
{
QItemSelectionModel* select = this->ui->admin_tableView->selectionModel();
QModelIndexList list = select->selectedRows();
for(int i = 0 ; i < list.size() ; i++ )
{
this->admin_model->removeRow(list.at(i).row());
}
}
void MainWindow::on_search_pushButton_2_clicked()
{
QString name = this->ui->search_lineEdit_2->text();
if(!(name == '#'))
{
QString str = QString("username = '%1' ").arg(name);
this->admin_model->setFilter(str);
this->admin_model->select();
}
else
{
this->admin_model->select();
}
}
void MainWindow::on_add_pushButton_3_clicked()
{
QSqlRecord record = this->student_model->record();
int row = this->student_model->rowCount();
this->student_model->insertRecord(row,record);
}
void MainWindow::on_save_pushButton_3_clicked()
{
this->student_model->submitAll();
}
void MainWindow::on_cancel_pushButton_3_clicked()
{
this->admin_model->revertAll();
this->admin_model->submitAll();
}
void MainWindow::on_delete_pushButton_3_clicked()
{
QItemSelectionModel* select = this->ui->student_tableView->selectionModel();
QModelIndexList list = select->selectedRows();
for(int i = 0 ; i < list.size() ; i++ )
{
this->student_model->removeRow(list.at(i).row());
}
}
void MainWindow::on_search_pushButton_3_clicked()
{
QString name = this->ui->search_lineEdit_3->text();
if(!(name == '#'))
{
QString str = QString("username = '%1' ").arg(name);
this->student_model->setFilter(str);
this->student_model->select();
}
else
{
this->student_model->select();
}
}
void MainWindow::on_add_pushButton_4_clicked()
{
QSqlRecord record = this->teacherself_model->record();
int row = this->teacherself_model->rowCount();
this->teacherself_model->insertRecord(row,record);
}
void MainWindow::on_save_pushButton_4_clicked()
{
this->teacherself_model->submitAll();
}
void MainWindow::on_cancel_pushButton_4_clicked()
{
this->teacherself_model->revertAll();
this->teacherself_model->submitAll();
}
void MainWindow::on_delete_pushButton_4_clicked()
{
QItemSelectionModel* select = this->ui->teacherself_tableView->selectionModel();
QModelIndexList list = select->selectedRows();
for(int i = 0 ; i < list.size() ; i++ )
{
this->teacherself_model->removeRow(list.at(i).row());
}
}
void MainWindow::on_search_pushButton_4_clicked()
{
QString name = this->ui->search_lineEdit_4->text();
if(!(name == '#'))
{
QString str = QString("Name = '%1' ").arg(name);
this->teacherself_model->setFilter(str);
this->teacherself_model->select();
}
else
{
this->teacherself_model->select();
}
}
#include "mainwindow.h"
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
该小程序是本人结合大一的上学期的知识写的一个小总结,本人学期编程也只有半年而已,难免有一些描述的不清楚,或者逻辑混乱的地方,还请多多指教。
在此感谢我的授课老师,感谢老师这段时间的付出、指导、教诲;感谢CSDN平台,感谢平台为我们普通学生提供的学习平台;感谢党和国家,感谢党和国家为莘莘学子构建了现今的时代。
PS:相应的注释并不完善,今后我会补充的。
本人今后也会在CSDN上分析一些学习感悟,希望您能够关注、留言、私信,感谢您的观看。