Files
GUI/src/AccountFormDialog.h

50 lines
1.2 KiB
C++

//
// Created by Krad on 2021/11/10.
//
#ifndef GUI_ACCOUNTFORMDIALOG_H
#define GUI_ACCOUNTFORMDIALOG_H
class QLabel;
class QLineEdit;
class QToolButton;
class QSqlTableModel;
#include "GUIFormBaseDialog.h"
enum AccountEditMode{
Self, Admin, New
};
class AccountFormDialog:public GUIFormBaseDialog{
Q_OBJECT
public:
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;
QToolButton* btn_Pwd = nullptr;
QLabel* lbl_error = nullptr;
QSqlTableModel* refmodel = nullptr;
};
#endif //GUI_ACCOUNTFORMDIALOG_H