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 <marco.bubke@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Eike Ziller
2017-09-05 12:01:13 +02:00
parent d010dbd190
commit ca3b882ab8

View File

@@ -3370,7 +3370,8 @@ void TextEditorWidget::resizeEvent(QResizeEvent *e)
QRect cr = rect(); QRect cr = rect();
d->m_extraArea->setGeometry( d->m_extraArea->setGeometry(
QStyle::visualRect(layoutDirection(), cr, 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->adjustScrollBarRanges();
d->updateCurrentLineInScrollbar(); d->updateCurrentLineInScrollbar();
} }
@@ -4649,6 +4650,9 @@ int TextEditorWidget::extraAreaWidth(int *markWidthPtr) const
if (!d->m_marksVisible && documentLayout->hasMarks) if (!d->m_marksVisible && documentLayout->hasMarks)
d->m_marksVisible = true; d->m_marksVisible = true;
if (!d->m_marksVisible && !d->m_lineNumbersVisible && !d->m_codeFoldingVisible)
return 0;
int space = 0; int space = 0;
const QFontMetrics fm(d->m_extraArea->fontMetrics()); const QFontMetrics fm(d->m_extraArea->fontMetrics());