Refactor dialog package.

This commit is contained in:
Krad
2022-06-13 11:21:44 +08:00
parent 9a233251dc
commit 69a506ff94
27 changed files with 870 additions and 828 deletions

View File

@@ -8,6 +8,8 @@ class QLabel;
class QLineEdit;
class QToolButton;
class QSqlTableModel;
#include <QtWidgets/QVBoxLayout>
#include "GUIFormBaseDialog.h"
enum AccountEditMode{
@@ -17,32 +19,44 @@ class AccountFormDialog:public GUIFormBaseDialog{
Q_OBJECT
public:
explicit AccountFormDialog(QWidget *parent = nullptr,AccountEditMode mode = Self,Qt::WindowFlags f = Qt::WindowFlags());
~AccountFormDialog();
~AccountFormDialog() override = default;
void setAccountInformation(const QMap<QString,QVariant>& values);
void setReferenceModel(QSqlTableModel* model){
refmodel = model;
mRefModel = model;
}
protected:
bool updateReferenceData() override;
void warn(QString msg);
void warn(const 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;
void addEndLine(QVBoxLayout *layout);
void addNewModeUI(QVBoxLayout *layout);
void addSelfModeUI(QHBoxLayout *layout);
void addTitleLabel(QVBoxLayout *layout);
void initUserCodeUI(QVBoxLayout *layout);
void initUserNameUI(QVBoxLayout *layout);
void addCommentLabel(QVBoxLayout *layout);
void addWarnLabel(QVBoxLayout *layout);
void addButtonPwd(QHBoxLayout *layout);
void changeSelfPassword();
void resetUserPassword();
QString mUserID;
QString mUserPwd;
QString mRoleID;
QString mNewUserName;
bool mUserNameChanged;
bool mCommentChanged;
bool mRoleChanged;
AccountEditMode mMode;
QLineEdit* mLeUserCode;
QLineEdit* mLeUserName;
QLineEdit* mLeComment;
QLineEdit* mLePwd;
QToolButton* mBtnPwd;
QLabel* mLblError;
QSqlTableModel* mRefModel;
QLabel* lbl_error = nullptr;
QSqlTableModel* refmodel = nullptr;
};