#4924 AppFwk ComboBox: Add minimum width

This commit is contained in:
Magne Sjaastad 2019-10-28 20:39:01 +01:00
parent 022d03a287
commit 7a470587ac
2 changed files with 12 additions and 3 deletions

View File

@ -227,6 +227,11 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
m_comboBox->setEditable(true);
}
if (m_attributes.minimumWidth != -1)
{
m_comboBox->setMinimumWidth(m_attributes.minimumWidth);
}
m_comboBox->blockSignals(false);
}
@ -405,13 +410,16 @@ void PdmUiComboBoxEditor::slotIndexActivated(int index)
{
if (m_attributes.enableEditableContent)
{
// Use the text directly, as the selected item text could be entered directly by the user
// Use the text directly, as the item text could be entered directly by the user
auto text = m_comboBox->itemText(index);
this->setValueToField(text);
}
else
{
// Use index as data carrier to PDM field
// The index will be used as a lookup in a list of option items
QVariant v;
v = index;

View File

@ -62,6 +62,7 @@ public:
showPreviousAndNextButtons = false;
minimumContentsLength = 8;
enableEditableContent = false;
minimumWidth = -1;
}
public:
@ -70,10 +71,10 @@ public:
int minimumContentsLength; // The length of string to adjust to if adjustWidthToContents = false.
// Set to <= 0 to ignore and use AdjustToContentsOnFirstShow instead
bool enableEditableContent;
int minimumWidth;
QString nextButtonText;
QString prevButtonText;
bool enableEditableContent;
};