forked from qt-creator/qt-creator
Set ElideMiddle for the editor combobox
When Qt Creator opens more than one file with same name, the path to be shown tend to long. In this case last part (file name) is as important as first part. paths in Locator and Open Document are elided in the middle of path already. Change-Id: I953a8068b50331f9ef20ad9efbd947b4dbcf0845 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -119,6 +119,7 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
|
||||
|
||||
d->m_editorList->setProperty("hideicon", true);
|
||||
d->m_editorList->setProperty("notelideasterisk", true);
|
||||
d->m_editorList->setProperty("elidemode", Qt::ElideMiddle);
|
||||
d->m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
d->m_editorList->setMinimumContentsLength(20);
|
||||
d->m_editorList->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
||||
|
@@ -886,7 +886,10 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
elideWidth -= option->fontMetrics.horizontalAdvance(asterisk);
|
||||
text = asterisk;
|
||||
}
|
||||
text.prepend(option->fontMetrics.elidedText(cb->currentText, Qt::ElideRight, elideWidth));
|
||||
Qt::TextElideMode elideMode = Qt::ElideRight;
|
||||
if (widget && widget->dynamicPropertyNames().contains("elidemode"))
|
||||
elideMode = widget->property("elidemode").value<Qt::TextElideMode>();
|
||||
text.prepend(option->fontMetrics.elidedText(cb->currentText, elideMode, elideWidth));
|
||||
|
||||
if (creatorTheme()->flag(Theme::ComboBoxDrawTextShadow)
|
||||
&& (option->state & State_Enabled))
|
||||
|
Reference in New Issue
Block a user