Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with selections on Masternode tab #2170

Merged
merged 1 commit into from Jul 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/qt/forms/masternodelist.ui
Expand Up @@ -228,6 +228,9 @@
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
Expand Down
7 changes: 6 additions & 1 deletion src/qt/masternodelist.cpp
Expand Up @@ -242,6 +242,11 @@ void MasternodeList::updateMyNodeList(bool fForce)
if(nSecondsTillUpdate > 0 && !fForce) return;
nTimeMyListUpdated = GetTime();

// Find selected row
QItemSelectionModel* selectionModel = ui->tableWidgetMyMasternodes->selectionModel();
QModelIndexList selected = selectionModel->selectedRows();
int nSelectedRow = selected.count() ? selected.at(0).row() : 0;

ui->tableWidgetMyMasternodes->setSortingEnabled(false);
for (const auto& mne : masternodeConfig.getEntries()) {
int32_t nOutputIndex = 0;
Expand All @@ -251,7 +256,7 @@ void MasternodeList::updateMyNodeList(bool fForce)

updateMyMasternodeInfo(QString::fromStdString(mne.getAlias()), QString::fromStdString(mne.getIp()), COutPoint(uint256S(mne.getTxHash()), nOutputIndex));
}
ui->tableWidgetMyMasternodes->selectRow(0);
ui->tableWidgetMyMasternodes->selectRow(nSelectedRow);
ui->tableWidgetMyMasternodes->setSortingEnabled(true);

// reset "timer"
Expand Down