feat: Fix account table select row when delete account.

This commit is contained in:
sunwen
2024-06-07 16:57:16 +08:00
parent 87bf729118
commit 1e4af17daf

View File

@@ -11,6 +11,7 @@
#include "models/User.h"
#include "components/SlideTableView.h"
#include "event/EventCenter.h"
#include "log/UserOperationLog.h"
AccountTableForm::AccountTableForm(QWidget* aParent)
: QWidget(aParent)
@@ -129,7 +130,9 @@ AccountTableForm::AccountTableForm(QWidget* aParent)
if ( DialogManager::Default()->requestAlertMessage(QString(tr("Delete account with ID:\"%1\"!")).arg(id), DialogButtonMode::OkAndCancel) != QDialog::Accepted) return;
model->removeRow(mCurrentRow);
model->select();
table->selectRow(model->rowCount() > mCurrentRow + 1 ? mCurrentRow : mCurrentRow - 1);
mCurrentRow = model->rowCount() > mCurrentRow + 1 ? mCurrentRow : mCurrentRow - 1;
table->selectRow(mCurrentRow);
LOG_USER_OPERATION("Delete Account, ID:" + id);
});
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {