diff options
Diffstat (limited to 'statisticsdialog.cpp')
-rw-r--r-- | statisticsdialog.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/statisticsdialog.cpp b/statisticsdialog.cpp index d533414..ccb513d 100644 --- a/statisticsdialog.cpp +++ b/statisticsdialog.cpp @@ -165,7 +165,7 @@ GraphWidget::GraphWidget(const QList<QList<QVariant> > data, const QString heade //calc max width of data, maxData and total QFontMetrics fmd = QFontMetrics(mDataFont); - for(QList<QVariant> d : mData){ + for(const auto &d : mData){ int width = fmd.size(Qt::TextSingleLine, d.at(0).toString()).width(); if(width > mDescWidth){ mDescWidth = width; @@ -178,9 +178,9 @@ GraphWidget::GraphWidget(const QList<QList<QVariant> > data, const QString heade } //set percentage width - for(QList<QVariant> d : mData){ + for(const auto &d : mData){ auto percentage = d.at(1).toDouble() * 100.0 / static_cast<double>(mTotal); - QString pString = QString("%1 (%2%)").arg(QString::number(d.at(1).toInt())).arg(QString::number(percentage, 'f', 2)); + QString pString = QString("%1 (%2%)").arg(QString::number(d.at(1).toInt()), QString::number(percentage, 'f', 2)); int width = fmd.size(Qt::TextSingleLine, pString).width(); if(width > mPercentageWidth){ mPercentageWidth = width; @@ -278,7 +278,7 @@ void GraphWidget::paintEvent(QPaintEvent *event){ opt.setAlignment(Qt::AlignRight | Qt::AlignVCenter); QTextOption optLeft; opt.setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - for(QList<QVariant> l : mData){ + for(const auto &l : mData){ //draw lead QRect textRect(0, 0, mDescWidth, mBarHeight); p.drawText(textRect, l.at(0).toString(), opt); @@ -297,7 +297,7 @@ void GraphWidget::paintEvent(QPaintEvent *event){ auto pstartx = dataRect.width() + 2 * mMargin + mDescWidth; QRectF percentageRect(pstartx, 0, mPercentageWidth, 20); qreal percent = l.at(1).toInt() * 100.0 / static_cast<double>(mTotal); - QString pString = QString("%1 (%2%)").arg(QString::number(l.at(1).toInt())).arg(QString::number(percent, 'f', 2)); + QString pString = QString("%1 (%2%)").arg(QString::number(l.at(1).toInt()), QString::number(percent, 'f', 2)); p.drawText(percentageRect, pString, optLeft); //translate p.translate(0, mMargin + mBarHeight); |