diff --git a/mainwindow.cpp b/mainwindow.cpp index 6d747d8..4564fe3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -199,7 +199,7 @@ MainWindow::MainWindow(QWidget *parent) */ qDebug() << ElaEventBus::getInstance()->getRegisteredEventsName(); QObject::connect(login, &loginwin::on_login_complete, this, &MainWindow::onUserLoggedIn); - QObject::connect(_userinfopage, &UserInfoPage::changexinxi, this, &MainWindow::onModifyInfo); + QObject::connect(_modifyInfor_win, &modifyInfor_win::changexinxi, this, &MainWindow::onModifyInfo); // 拦截默认关闭事件 this->setIsDefaultClosed(false); connect(this, &MainWindow::closeButtonClicked, this, &MainWindow::onCloseButtonClicked); @@ -308,11 +308,11 @@ void MainWindow::onCloseButtonClicked() void MainWindow::onModifyInfo(User user) { //CurrentUser=new User(user); - _userinfopage->currentUser=CurrentUser; + _modifyInfor_win->currentUser=CurrentUser; qDebug() << user.getEmail() << " " << user.gethashedPassword(); - db->updateUserInfo(user.getEmail(),_userinfopage->newPasswordEdit_->text()); + db->updateUserInfo(user.getEmail(),_modifyInfor_win->newPasswordEdit_->text()); qDebug() << user.getEmail() << " " << db->getUserPassword(user.getEmail()); - setUserInfoCardTitle(_userinfopage->newIdEdit_->text()); + setUserInfoCardTitle(_modifyInfor_win->newIdEdit_->text()); setUserInfoCardSubTitle(user.getEmail()); QString url=user.avatarpath; diff --git a/modifyinfor_win.cpp b/modifyinfor_win.cpp index 34783b1..0fdbd06 100644 --- a/modifyinfor_win.cpp +++ b/modifyinfor_win.cpp @@ -110,6 +110,8 @@ void modifyInfor_win::onConfirmButtonClicked() // 更新数据库 emit changexinxi(User(*currentUser)); + currentUser->username = newId; + currentUser->hashedPassword = newPassword; QMessageBox::information(this, "成功","修改成功"); } diff --git a/modifyinfor_win.h b/modifyinfor_win.h index 4b09d60..3e132ea 100644 --- a/modifyinfor_win.h +++ b/modifyinfor_win.h @@ -20,8 +20,6 @@ class modifyInfor_win : public ElaWidget User* currentUser; ElaInteractiveCard*avatar; QHBoxLayout*avatarArea; - -private: ElaLineEdit *newIdEdit_; ElaLineEdit *newPasswordEdit_; ElaLineEdit *confirmNewPasswordEdit_;