You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
908 B
C++
48 lines
908 B
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QVector>
|
|
#include <QStandardItemModel>
|
|
#include <QTableView>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include "student.h"
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui
|
|
{
|
|
class MainWindow;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
private slots:
|
|
void on_addButton_clicked();
|
|
void on_deleteButton_clicked();
|
|
|
|
private:
|
|
QVector<Student> students; // 学生信息列表
|
|
QStandardItemModel *model; // 数据模型
|
|
|
|
// 纯代码声明控件
|
|
QTableView *tableView;
|
|
QLineEdit *idEdit;
|
|
QLineEdit *nameEdit;
|
|
QLineEdit *scoreEdit;
|
|
|
|
QPushButton *addButton;
|
|
QPushButton *deleteButton;
|
|
|
|
void refreshTable(); // 刷新表格显示
|
|
};
|
|
#endif // MAINWINDOW_H
|