Account Table and form update, add edit and add function .

This commit is contained in:
Krad
2021-12-10 10:17:45 +08:00
parent aed07807a6
commit dce0ad563c
4 changed files with 330 additions and 44 deletions

View File

@@ -4,21 +4,45 @@
#ifndef GUI_ACCOUNTFORMDIALOG_H
#define GUI_ACCOUNTFORMDIALOG_H
class QLabel;
class QLineEdit;
class QPushButton;
class QSqlTableModel;
#include "GUIFormBaseDialog.h"
enum AccountEditMode{
Self, Admin, New
};
class AccountFormDialog:public GUIFormBaseDialog{
Q_OBJECT
public:
explicit AccountFormDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
explicit AccountFormDialog(QWidget *parent = nullptr,AccountEditMode mode = Self,Qt::WindowFlags f = Qt::WindowFlags());
~AccountFormDialog();
void setAccountInformation(const QMap<QString,QVariant>& values);
void setReferenceModel(QSqlTableModel* model){
refmodel = model;
}
protected:
bool updateReferenceData() override;
void warn(QString msg);
void hideWarn();
private:
QString m_UserID;
QString m_UserPwd;
QString m_RoleID;
QString m_NewUserName;
bool userNameChanged = false;
bool commentChanged = false;
bool roleChanged = false;
AccountEditMode m_mode = Self;
QLineEdit* le_UserCode = nullptr;
QLineEdit* le_UserName = nullptr;
QLineEdit* le_Comment = nullptr;
QLineEdit* le_Pwd = nullptr;
QPushButton* btn_Pwd = nullptr;
QPushButton* btn_Role = nullptr;
QLabel* lbl_error = nullptr;
QSqlTableModel* refmodel = nullptr;
};