forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.11' into 4.12
Change-Id: I7e526857a4d9e63838f76d5e3fbb0db7287d5617
This commit is contained in:
@@ -646,6 +646,7 @@ public:
|
|||||||
MarginSettings m_marginSettings;
|
MarginSettings m_marginSettings;
|
||||||
// apply when making visible the first time, for the split case
|
// apply when making visible the first time, for the split case
|
||||||
bool m_fontSettingsNeedsApply = true;
|
bool m_fontSettingsNeedsApply = true;
|
||||||
|
bool m_wasNotYetShown = true;
|
||||||
BehaviorSettings m_behaviorSettings;
|
BehaviorSettings m_behaviorSettings;
|
||||||
|
|
||||||
int extraAreaSelectionAnchorBlockNumber = -1;
|
int extraAreaSelectionAnchorBlockNumber = -1;
|
||||||
@@ -4331,16 +4332,12 @@ void TextEditorWidgetPrivate::paintCurrentLineHighlight(const PaintEventData &da
|
|||||||
QRectF lineRect = data.block.layout()->lineForTextPosition(data.textCursor.positionInBlock()).rect();
|
QRectF lineRect = data.block.layout()->lineForTextPosition(data.textCursor.positionInBlock()).rect();
|
||||||
lineRect.moveTop(lineRect.top() + blockRect.top());
|
lineRect.moveTop(lineRect.top() + blockRect.top());
|
||||||
lineRect.setLeft(0);
|
lineRect.setLeft(0);
|
||||||
lineRect.setRight(data.viewportRect.width() - data.offset.x());
|
lineRect.setRight(data.viewportRect.width());
|
||||||
QColor color = m_document->fontSettings().toTextCharFormat(C_CURRENT_LINE).background().color();
|
QColor color = m_document->fontSettings().toTextCharFormat(C_CURRENT_LINE).background().color();
|
||||||
// set alpha, otherwise we cannot see block highlighting and find scope underneath
|
// set alpha, otherwise we cannot see block highlighting and find scope underneath
|
||||||
color.setAlpha(128);
|
color.setAlpha(128);
|
||||||
if (!data.eventRect.contains(lineRect.toRect())) {
|
if (!data.eventRect.contains(lineRect.toRect()))
|
||||||
QRect updateRect = data.eventRect;
|
q->viewport()->update(lineRect.toRect());
|
||||||
updateRect.setLeft(0);
|
|
||||||
updateRect.setRight(data.viewportRect.width() - int(data.offset.x()));
|
|
||||||
q->viewport()->update(updateRect);
|
|
||||||
}
|
|
||||||
painter.fillRect(lineRect, color);
|
painter.fillRect(lineRect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7217,10 +7214,20 @@ void TextEditorWidget::encourageApply()
|
|||||||
void TextEditorWidget::showEvent(QShowEvent* e)
|
void TextEditorWidget::showEvent(QShowEvent* e)
|
||||||
{
|
{
|
||||||
triggerPendingUpdates();
|
triggerPendingUpdates();
|
||||||
|
// QPlainTextEdit::showEvent scrolls to make the cursor visible on first show
|
||||||
|
// which we don't want, since we restore previous states when
|
||||||
|
// opening editors, and when splitting/duplicating.
|
||||||
|
// So restore the previous state after that.
|
||||||
|
QByteArray state;
|
||||||
|
if (d->m_wasNotYetShown)
|
||||||
|
state = saveState();
|
||||||
QPlainTextEdit::showEvent(e);
|
QPlainTextEdit::showEvent(e);
|
||||||
|
if (d->m_wasNotYetShown) {
|
||||||
|
restoreState(state);
|
||||||
|
d->m_wasNotYetShown = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TextEditorWidgetPrivate::applyFontSettingsDelayed()
|
void TextEditorWidgetPrivate::applyFontSettingsDelayed()
|
||||||
{
|
{
|
||||||
m_fontSettingsNeedsApply = true;
|
m_fontSettingsNeedsApply = true;
|
||||||
|
Reference in New Issue
Block a user