mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4924 AppFwk ComboBox: Add minimum width
This commit is contained in:
parent
022d03a287
commit
7a470587ac
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user