Add SQLHelper and CenterAlignSqlTableModel. The CenterAlignSqlTableModel only make the cell text align center.

This commit is contained in:
Krad
2021-10-12 10:23:34 +08:00
parent b072db0c4a
commit a8ad054331
4 changed files with 100 additions and 0 deletions

25
src/db/SQLHelper.h Normal file
View File

@@ -0,0 +1,25 @@
//
// Created by Krad on 2021/10/11.
//
#ifndef GUI_SQLHELPER_H
#define GUI_SQLHELPER_H
class QSqlDatabase;
#include "CenterAlignSqlTableModel.h"
#include <QString>
#include <QHash>
class SQLHelper {
public:
static bool Open();
static bool Open(QSqlDatabase* base);
static void Close();
static QSqlTableModel* getTable(const QString & tableName);
private:
static QSqlDatabase* defaultDatabase;
static QHash<QString,CenterAlignSqlTableModel*>* cache;
};
#endif //GUI_SQLHELPER_H