Skip to content

Commit a22c487

Browse files
committed
[GUI] dashboard hasStakes method.
1 parent d9e79be commit a22c487

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/qt/pivx/dashboardwidget.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void DashboardWidget::openFAQ(){
225225

226226
void DashboardWidget::onTxArrived(const QString& hash) {
227227
showList();
228-
if (stakesFilter->rowCount() > 0 && walletModel->isCoinStake(hash)) {
228+
if (hasStakes() && walletModel->isCoinStake(hash)) {
229229
refreshChart();
230230
}
231231
}
@@ -268,15 +268,14 @@ void DashboardWidget::walletSynced(bool sync){
268268

269269
void DashboardWidget::changeTheme(bool isLightTheme, QString& theme){
270270
static_cast<TxViewHolder*>(this->txViewDelegate->getRowFactory())->isLightTheme = isLightTheme;
271-
if (stakesFilter->rowCount() > 0)
271+
if (hasStakes())
272272
this->changeChartColors();
273273
}
274274

275275
const QStringList monthsNames = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
276276

277277
void DashboardWidget::loadChart(){
278-
int size = stakesFilter->rowCount();
279-
if (size > 0) {
278+
if (hasStakes()) {
280279
if (!chart) {
281280
ui->layoutChart->setVisible(true);
282281
ui->emptyContainerChart->setVisible(false);
@@ -618,7 +617,7 @@ void DashboardWidget::onChartArrowClicked() {
618617
}
619618

620619
void DashboardWidget::windowResizeEvent(QResizeEvent *event){
621-
if (stakesFilter->rowCount() > 0 && axisX) {
620+
if (hasStakes() > 0 && axisX) {
622621
if (width() > 1300) {
623622
if (isChartMin) {
624623
isChartMin = false;
@@ -650,6 +649,10 @@ void DashboardWidget::windowResizeEvent(QResizeEvent *event){
650649
}
651650
}
652651

652+
bool DashboardWidget::hasStakes() {
653+
return stakesFilter->rowCount() > 0;
654+
}
655+
653656
DashboardWidget::~DashboardWidget(){
654657
delete ui;
655658
delete chart;

src/qt/pivx/dashboardwidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ private slots:
124124
void updateAxisX(const QStringList *arg = nullptr);
125125
void setChartShow(ChartShowType type);
126126
std::pair<int, int> getChartRange(QMap<int, std::pair<qint64, qint64>> amountsBy);
127+
bool hasStakes();
127128
};
128129

129130
#endif // DASHBOARDWIDGET_H

0 commit comments

Comments
 (0)