diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-09-26 09:37:07 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-09-26 09:37:07 +0200 |
commit | 18ffdbb12ef838b159db648f973f82467983ef88 (patch) | |
tree | 238700adc372b19eeded2ba092a11dc0b59301a2 /src/plugins/texteditor | |
parent | c297846fec5509c40e57c4ee65c6a74dd2cc0ac4 (diff) | |
parent | 048f27633daa295a0cd5effd0b15c2cd8ea105fa (diff) | |
download | qt-creator-18ffdbb12ef838b159db648f973f82467983ef88.tar.gz |
Merge remote-tracking branch 'origin/master' into 4.8
Change-Id: Iaad349302545619f5299fbab26aff11790ca122e
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r-- | src/plugins/texteditor/texteditoroverlay.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index c6e1489d36..60fe5cc99e 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -32,6 +32,8 @@ #include <QPainter> #include <QTextBlock> +#include <algorithm> + using namespace TextEditor; using namespace TextEditor::Internal; @@ -250,10 +252,10 @@ QPainterPath TextEditorOverlay::createSelectionPath(const QTextCursor &begin, co const int count = selection.count(); for (int i = 1; i < count-1; ++i) { -#define MAX3(a,b,c) qMax(a, qMax(b,c)) - qreal x = MAX3(selection.at(i-1).right(), - selection.at(i).right(), - selection.at(i+1).right()) + margin; + qreal x = std::max({selection.at(i - 1).right(), + selection.at(i).right(), + selection.at(i + 1).right()}) + + margin; points += QPointF(x+1, selection.at(i).top()); points += QPointF(x+1, selection.at(i).bottom()); @@ -266,10 +268,10 @@ QPainterPath TextEditorOverlay::createSelectionPath(const QTextCursor &begin, co points += lastSelection.topLeft() + QPointF(-margin, 0); for (int i = count-2; i > 0; --i) { -#define MIN3(a,b,c) qMin(a, qMin(b,c)) - qreal x = MIN3(selection.at(i-1).left(), - selection.at(i).left(), - selection.at(i+1).left()) - margin; + qreal x = std::min({selection.at(i - 1).left(), + selection.at(i).left(), + selection.at(i + 1).left()}) + - margin; points += QPointF(x, selection.at(i).bottom()+extra); points += QPointF(x, selection.at(i).top()); |