#4282 Let ComboBoxEditor be narrowed smaller than full text string by default

This commit is contained in:
Gaute Lindkvist 2019-04-05 09:00:32 +02:00
parent c1a5397a6f
commit 8e6ac03c75
2 changed files with 10 additions and 2 deletions

View File

@ -215,6 +215,11 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
{
m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
}
else if (attributes.minimumContentsLength > 0)
{
m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
m_comboBox->setMinimumContentsLength(attributes.minimumContentsLength);
}
m_comboBox->blockSignals(false);
}

View File

@ -58,14 +58,17 @@ class PdmUiComboBoxEditorAttribute : public PdmUiEditorAttribute
public:
PdmUiComboBoxEditorAttribute()
{
adjustWidthToContents = false;
adjustWidthToContents = false;
showPreviousAndNextButtons = false;
minimumContentsLength = 8;
}
public:
bool adjustWidthToContents;
bool showPreviousAndNextButtons;
int minimumContentsLength; // The length of string to adjust to if adjustWidthToContents = false.
// Set to <= 0 to ignore and use AdjustToContentsOnFirstShow instead
QString nextButtonText;
QString prevButtonText;
};