forked from qt-creator/qt-creator
TextEditor: Add toolbar widgets only after a valid toolbar action
We can't just add widgets after the first action of the toolbar. The first action might not have a widget and will assert for that reason in Qt. Change-Id: Ib69c7d6d91bd56f25023aaebf961fef15cdcf008 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -7801,10 +7801,16 @@ QAction * TextEditorWidget::insertExtraToolBarWidget(TextEditorWidget::Side side
|
||||
d->m_stretchWidget = nullptr;
|
||||
}
|
||||
|
||||
if (side == Right)
|
||||
if (side == Left) {
|
||||
QAction *before = Utils::findOr(d->m_toolBar->actions(),
|
||||
d->m_fileEncodingLabelAction,
|
||||
[this](QAction *action) {
|
||||
return d->m_toolBar->widgetForAction(action) != nullptr;
|
||||
});
|
||||
return d->m_toolBar->insertWidget(before, widget);
|
||||
} else {
|
||||
return d->m_toolBar->insertWidget(d->m_fileEncodingLabelAction, widget);
|
||||
else
|
||||
return d->m_toolBar->insertWidget(d->m_toolBar->actions().constFirst(), widget);
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditorWidget::keepAutoCompletionHighlight(bool keepHighlight)
|
||||
|
||||
Reference in New Issue
Block a user