mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fwk: Allow label text on check box widget
This commit is contained in:
parent
bcb0bce1da
commit
d93a98815a
@ -63,14 +63,24 @@ void PdmUiCheckBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
|
|||||||
assert(!m_checkBox.isNull());
|
assert(!m_checkBox.isNull());
|
||||||
assert(!m_label.isNull());
|
assert(!m_label.isNull());
|
||||||
|
|
||||||
QIcon ic = field()->uiIcon(uiConfigName);
|
PdmUiCheckBoxEditorAttribute attributes;
|
||||||
if (!ic.isNull())
|
field()->ownerObject()->editorAttribute(field(), uiConfigName, &attributes);
|
||||||
|
|
||||||
|
if (attributes.m_useNativeCheckBoxLabel)
|
||||||
{
|
{
|
||||||
m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64))));
|
m_checkBox->setText(field()->uiName(uiConfigName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_label->setText(field()->uiName(uiConfigName));
|
QIcon ic = field()->uiIcon(uiConfigName);
|
||||||
|
if (!ic.isNull())
|
||||||
|
{
|
||||||
|
m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64))));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_label->setText(field()->uiName(uiConfigName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||||
@ -79,9 +89,6 @@ void PdmUiCheckBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
|
|||||||
m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||||
m_checkBox->setToolTip(field()->uiToolTip(uiConfigName));
|
m_checkBox->setToolTip(field()->uiToolTip(uiConfigName));
|
||||||
|
|
||||||
PdmUiCheckBoxEditorAttribute attributes;
|
|
||||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &attributes);
|
|
||||||
|
|
||||||
m_checkBox->setChecked(field()->uiValue().toBool());
|
m_checkBox->setChecked(field()->uiValue().toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,14 @@ namespace caf
|
|||||||
|
|
||||||
class PdmUiCheckBoxEditorAttribute : public PdmUiEditorAttribute
|
class PdmUiCheckBoxEditorAttribute : public PdmUiEditorAttribute
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
PdmUiCheckBoxEditorAttribute()
|
||||||
|
{
|
||||||
|
m_useNativeCheckBoxLabel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool m_useNativeCheckBoxLabel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user