diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2016-02-08 11:11:32 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2016-02-09 08:43:45 +0000 |
commit | bab230313db3410366f813c5402f2792054c1777 (patch) | |
tree | fff075dc6fb826372b3a3487c41e314f89369372 /src/plugins/texteditor/refactoroverlay.cpp | |
parent | b34b019c106ce30db68eacd12c043ea0237bba9e (diff) |
TextEditor: Clean up RefactorOverlay::paintMarker
* Rename variables for readability
* Use const
Change-Id: I74d44a5075738b1aef28a97f647431848564544a
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/texteditor/refactoroverlay.cpp')
-rw-r--r-- | src/plugins/texteditor/refactoroverlay.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/texteditor/refactoroverlay.cpp b/src/plugins/texteditor/refactoroverlay.cpp index 310c6322cb..7af475b8d8 100644 --- a/src/plugins/texteditor/refactoroverlay.cpp +++ b/src/plugins/texteditor/refactoroverlay.cpp @@ -64,27 +64,28 @@ RefactorMarker RefactorOverlay::markerAt(const QPoint &pos) const void RefactorOverlay::paintMarker(const RefactorMarker& marker, QPainter *painter, const QRect &clip) { - QPointF offset = m_editor->contentOffset(); - QRectF geometry = m_editor->blockBoundingGeometry(marker.cursor.block()).translated(offset); + const QPointF offset = m_editor->contentOffset(); + const QRectF geometry = m_editor->blockBoundingGeometry(marker.cursor.block()).translated(offset); if (geometry.top() > clip.bottom() + 10 || geometry.bottom() < clip.top() - 10) return; // marker not visible - QTextCursor cursor = marker.cursor; - - QRect r = m_editor->cursorRect(cursor); + const QTextCursor cursor = marker.cursor; + const QRect cursorRect = m_editor->cursorRect(cursor); QIcon icon = marker.icon; if (icon.isNull()) icon = m_icon; - QSize sz = icon.actualSize(QSize(m_editor->fontMetrics().width(QLatin1Char(' '))+2, r.height())); + const QSize proposedIconSize = QSize(m_editor->fontMetrics().width(QLatin1Char(' ')) + 2, + cursorRect.height()); + const QSize actualIconSize = icon.actualSize(proposedIconSize); - int x = r.right(); - marker.rect = QRect(x, r.top(), sz.width(), sz.height()); + const int x = cursorRect.right(); + marker.rect = QRect(x, cursorRect.top(), actualIconSize.width(), actualIconSize.height()); icon.paint(painter, marker.rect); - m_maxWidth = qMax((qreal)m_maxWidth, x + sz.width() - offset.x()); + m_maxWidth = qMax(m_maxWidth, x + actualIconSize.width() - int(offset.x())); } } // namespace TextEditor |