From ca3b882ab8e4fb49fabc8d606331c982bd541faf Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 5 Sep 2017 12:01:13 +0200 Subject: [PATCH] TextEditor: Fix painting with frame turned on When using our text editor in a normal panel, we want to turn on the frame again. Make sure that the extra text editor area does not overlap the frame, and also make sure that there is no extra area shown at all if all its features are turned off. This fixes the painting of the input fields in the Clang Query advanced search. Task-number: QTCREATORBUG-18815 Change-Id: Ie74f87ddc576c02cd5ea7650f2632fe91df143eb Reviewed-by: Marco Bubke Reviewed-by: Tim Jenssen --- src/plugins/texteditor/texteditor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index d395656da66..06f02615eba 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -3370,7 +3370,8 @@ void TextEditorWidget::resizeEvent(QResizeEvent *e) QRect cr = rect(); d->m_extraArea->setGeometry( QStyle::visualRect(layoutDirection(), cr, - QRect(cr.left(), cr.top(), extraAreaWidth(), cr.height()))); + QRect(cr.left() + frameWidth(), cr.top() + frameWidth(), + extraAreaWidth(), cr.height() - 2 * frameWidth()))); d->adjustScrollBarRanges(); d->updateCurrentLineInScrollbar(); } @@ -4649,6 +4650,9 @@ int TextEditorWidget::extraAreaWidth(int *markWidthPtr) const if (!d->m_marksVisible && documentLayout->hasMarks) d->m_marksVisible = true; + if (!d->m_marksVisible && !d->m_lineNumbersVisible && !d->m_codeFoldingVisible) + return 0; + int space = 0; const QFontMetrics fm(d->m_extraArea->fontMetrics());