You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.1 KiB
60 lines
1.1 KiB
6 months ago
|
#ifndef CLASS_TABLE_H
|
||
|
#define CLASS_TABLE_H
|
||
|
|
||
|
#include <QWidget>
|
||
|
#include <QSqlDatabase>
|
||
|
#include <QSqlQuery>
|
||
|
#include <QMainWindow>
|
||
|
#include <QLabel>
|
||
|
#include <QSqlTableModel>
|
||
|
#include <QHBoxLayout>
|
||
|
#include <QVBoxLayout>
|
||
|
#include <QGridLayout>
|
||
|
#include <QTableView>
|
||
|
#include <QComboBox>
|
||
|
#include <QLineEdit>
|
||
|
#include <QDataWidgetMapper>
|
||
|
#include <QSqlQueryModel>
|
||
|
#include <QItemSelectionModel>
|
||
|
#include <QSpinBox>
|
||
|
#include <QStandardItemModel>
|
||
|
|
||
|
namespace Ui {
|
||
|
class class_table;
|
||
|
}
|
||
|
|
||
|
class class_table : public QWidget
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit class_table(QWidget *parent = nullptr);
|
||
|
~class_table();
|
||
|
|
||
|
private:
|
||
|
Ui::class_table *ui;
|
||
|
|
||
|
/* 数据库连接类 */
|
||
|
QSqlDatabase sqlDatabase;
|
||
|
|
||
|
/* 用于查询数据 */
|
||
|
QSqlQueryModel *sqlQueryModel;
|
||
|
|
||
|
/* 数据库操作模型 */
|
||
|
QSqlTableModel *model;
|
||
|
|
||
|
/* 数据映射 */
|
||
|
QDataWidgetMapper *dataWidgetMapper;
|
||
|
|
||
|
/* 选择模型 */
|
||
|
QItemSelectionModel * itemSelectionModel;
|
||
|
|
||
|
/* 数据库初始化 */
|
||
|
void sqldata_init();
|
||
|
|
||
|
/* 数据库删除 */
|
||
|
void sqldata_delate(int row);
|
||
|
};
|
||
|
|
||
|
#endif // CLASS_TABLE_H
|