summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaks Naumov <maksqwe1@ukr.net>2014-09-02 22:53:35 +0300
committerMarc Mutz <marc.mutz@kdab.com>2014-09-03 13:30:12 +0200
commit7af329fdf2ab25c38858fed8bb33e4fa0200766f (patch)
tree55eb5f54d4e0661c7d6aaafa520789c750e2900c
parent4dae1a685c3d78fa0601e8490117e9a62336c398 (diff)
Widgets: remove pointless assignments
Assignment of a value was two times successively for same variable while the variable itself is not used between these assignments. Change-Id: I3c457e3af0505d32a64f6c8576b458cd15a951e5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r--src/widgets/util/qscroller.cpp5
-rw-r--r--src/widgets/widgets/qlineedit.cpp4
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp3
3 files changed, 4 insertions, 8 deletions
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 235cbc7865..abbba87039 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -746,9 +746,8 @@ void QScroller::ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin,
return;
// -- calculate the current pos (or the position after the current scroll)
- QPointF startPos = d->contentPosition + d->overshootPosition;
- startPos = QPointF(d->scrollingSegmentsEndPos(Qt::Horizontal),
- d->scrollingSegmentsEndPos(Qt::Vertical));
+ QPointF startPos(d->scrollingSegmentsEndPos(Qt::Horizontal),
+ d->scrollingSegmentsEndPos(Qt::Vertical));
QRectF marginRect(rect.x() - xmargin, rect.y() - ymargin,
rect.width() + 2 * xmargin, rect.height() + 2 * ymargin);
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index b6b7ffb1a2..461be744ff 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1877,14 +1877,12 @@ void QLineEdit::paintEvent(QPaintEvent *)
{
Q_D(QLineEdit);
QPainter p(this);
-
- QRect r = rect();
QPalette pal = palette();
QStyleOptionFrameV2 panel;
initStyleOption(&panel);
style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
- r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
+ QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
r.setX(r.x() + d->effectiveLeftTextMargin());
r.setY(r.y() + d->topTextMargin);
r.setRight(r.right() - d->effectiveRightTextMargin());
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index df13085dee..3f34a08b5e 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -690,10 +690,9 @@ void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceC
QRectF br = control->blockBoundingRect(block);
if (!br.isValid())
return;
- QRectF lr = br;
QTextLine line = block.layout()->lineForTextPosition(position - block.position());
Q_ASSERT(line.isValid());
- lr = line.naturalTextRect().translated(br.topLeft());
+ QRectF lr = line.naturalTextRect().translated(br.topLeft());
if (lr.bottom() >= visible.bottom() || (center && lr.top() < visible.top()) || forceCenter){