From 90593ed92cfd5d49900a6fb6c2c10a482ab9fdbb Mon Sep 17 00:00:00 2001 From: practicalswift Date: Sun, 4 Jun 2017 22:45:22 +0200 Subject: Limit variable scope --- src/qt/coincontroltreewidget.cpp | 5 +++-- src/qt/recentrequeststablemodel.cpp | 3 +-- src/qt/trafficgraphwidget.cpp | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/qt') diff --git a/src/qt/coincontroltreewidget.cpp b/src/qt/coincontroltreewidget.cpp index f86bc0851f..88510b6168 100644 --- a/src/qt/coincontroltreewidget.cpp +++ b/src/qt/coincontroltreewidget.cpp @@ -16,9 +16,10 @@ void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event) if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox { event->ignore(); - int COLUMN_CHECKBOX = 0; - if(this->currentItem()) + if (this->currentItem()) { + int COLUMN_CHECKBOX = 0; this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked)); + } } else if (event->key() == Qt::Key_Escape) // press esc -> close dialog { diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index dac3979290..e4c857e40b 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -55,10 +55,9 @@ QVariant RecentRequestsTableModel::data(const QModelIndex &index, int role) cons if(!index.isValid() || index.row() >= list.length()) return QVariant(); - const RecentRequestEntry *rec = &list[index.row()]; - if(role == Qt::DisplayRole || role == Qt::EditRole) { + const RecentRequestEntry *rec = &list[index.row()]; switch(index.column()) { case Date: diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 601d554c02..06f9c5134a 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -47,13 +47,14 @@ int TrafficGraphWidget::getGraphRangeMins() const void TrafficGraphWidget::paintPath(QPainterPath &path, QQueue &samples) { - int h = height() - YMARGIN * 2, w = width() - XMARGIN * 2; - int sampleCount = samples.size(), x = XMARGIN + w, y; + int sampleCount = samples.size(); if(sampleCount > 0) { + int h = height() - YMARGIN * 2, w = width() - XMARGIN * 2; + int x = XMARGIN + w; path.moveTo(x, YMARGIN + h); for(int i = 0; i < sampleCount; ++i) { x = XMARGIN + w - w * i / DESIRED_SAMPLES; - y = YMARGIN + h - (int)(h * samples.at(i) / fMax); + int y = YMARGIN + h - (int)(h * samples.at(i) / fMax); path.lineTo(x, y); } path.lineTo(x, YMARGIN + h); -- cgit v1.2.3