Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Nov 24, 2023
1 parent a732310 commit 1d7b246
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/qt/voting/polltab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ PollTab::PollTab(QWidget* parent)
connect(ui->table, &QAbstractItemView::doubleClicked, this, &PollTab::showPreferredDialog);
connect(ui->table, &QWidget::customContextMenuRequested, this, &PollTab::showTableContextMenu);
connect(m_polltable_model.get(), &PollTableModel::layoutChanged, this, &PollTab::finishRefresh);

// Forward the polltable model signal to the Poll Tab signal to avoid having to directly include the PollTableModel
// in the voting page.
connect(m_polltable_model.get(), &PollTableModel::newVoteReceivedAndPollMarkedDirty,
this, &PollTab::newVoteReceivedAndPollMarkedDirty);
}

PollTab::~PollTab()
Expand Down
3 changes: 3 additions & 0 deletions src/qt/voting/polltab.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class PollTab : public QWidget
void setVotingModel(VotingModel* voting_model);
void setPollFilterFlags(GRC::PollFilterFlag flags);

signals:
void newVoteReceivedAndPollMarkedDirty();

public slots:
void changeViewMode(const ViewId view_id);
void refresh();
Expand Down
2 changes: 2 additions & 0 deletions src/qt/voting/polltablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ void PollTableModel::refresh()
void PollTableModel::handlePollStaleFlag(QString poll_txid_string)
{
m_data_model->handlePollStaleFlag(poll_txid_string);

emit newVoteReceivedAndPollMarkedDirty();
}

void PollTableModel::changeTitleFilter(const QString& pattern)
Expand Down
3 changes: 3 additions & 0 deletions src/qt/voting/polltablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class PollTableModel : public QSortFilterProxyModel
QString columnName(int offset) const;
const PollItem* rowItem(int row) const;

signals:
void newVoteReceivedAndPollMarkedDirty();

public slots:
void refresh();
void changeTitleFilter(const QString& pattern);
Expand Down
8 changes: 5 additions & 3 deletions src/qt/voting/votingpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ void VotingPage::setVotingModel(VotingModel* model)
// Now that PollItem caching is available, automatically refresh current poll tab on receipt of new poll or vote.
connect(model, &VotingModel::newPollReceived, [this]() {
ui->pollReceivedLabel->show();
currentTab().refresh();
getActiveTab()->refresh();
ui->pollReceivedLabel->hide();
});

connect(model, &VotingModel::newVoteReceived, [this]() {
currentTab().refresh();
// Using the newVoteReceivedAndPollMarkedDirty instead of newVoteReceived insures the poll staleness flag in the appropriate
// poll item has been marked dirty before the refresh is called.
connect(getActiveTab(), &PollTab::newVoteReceivedAndPollMarkedDirty, [this]() {
getActiveTab()->refresh();
});
}

Expand Down

0 comments on commit 1d7b246

Please sign in to comment.