diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp index d5806c27f4..3db9a7ac74 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp @@ -72,23 +72,15 @@ void PdmUiCheckBoxEditor::configureAndUpdateUi(const QString& uiConfigName) if (attributes.m_useNativeCheckBoxLabel) { m_checkBox->setText(field()->uiName(uiConfigName)); + + m_label->setEnabled(!field()->isUiReadOnly(uiConfigName)); + m_label->setToolTip(field()->uiToolTip(uiConfigName)); } else { - 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)); - } + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); } - m_label->setEnabled(!field()->isUiReadOnly(uiConfigName)); - m_label->setToolTip(field()->uiToolTip(uiConfigName)); - m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_checkBox->setToolTip(field()->uiToolTip(uiConfigName)); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp index 5463c3f016..5a4c898451 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp @@ -28,20 +28,7 @@ void PdmUiCheckBoxTristateEditor::configureAndUpdateUi(const QString& uiConfigNa CAF_ASSERT(!m_checkBox.isNull()); CAF_ASSERT(!m_label.isNull()); - { - 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->setToolTip(field()->uiToolTip(uiConfigName)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_checkBox->setToolTip(field()->uiToolTip(uiConfigName)); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp index 8c8e59e05f..f55319deca 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp @@ -46,12 +46,12 @@ #include "cafFactory.h" -#include -#include #include -#include -#include #include +#include +#include +#include +#include namespace caf @@ -67,7 +67,6 @@ PdmUiColorEditor::PdmUiColorEditor() m_color = QColor::Invalid; } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -75,17 +74,7 @@ void PdmUiColorEditor::configureAndUpdateUi(const QString& uiConfigName) { CAF_ASSERT(!m_label.isNull()); - 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)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject()); if (uiObject) @@ -97,7 +86,6 @@ void PdmUiColorEditor::configureAndUpdateUi(const QString& uiConfigName) setColor(col); } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -135,7 +123,6 @@ QWidget* PdmUiColorEditor::createLabelWidget(QWidget * parent) return m_label; } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -154,7 +141,6 @@ void PdmUiColorEditor::colorSelectionClicked() } } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index eaa82aab04..14b9a54f89 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -60,16 +60,7 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName) { if (!m_label.isNull()) { - 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)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); } if (!m_comboBox.isNull()) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp index 17102f5f2f..e7489a265f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp @@ -71,17 +71,7 @@ void PdmUiDateEditor::configureAndUpdateUi(const QString& uiConfigName) { CAF_ASSERT(!m_dateEdit.isNull()); - 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)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_dateEdit->setEnabled(!field()->isUiReadOnly(uiConfigName)); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp index f1de0f9202..9385044e88 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp @@ -95,17 +95,7 @@ void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName) { CAF_ASSERT(!m_lineEdit.isNull()); - 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)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_lineEdit->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_slider->setEnabled(!field()->isUiReadOnly(uiConfigName)); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp index 3cc56f4317..0bade2b9ed 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp @@ -69,18 +69,7 @@ void PdmUiFilePathEditor::configureAndUpdateUi(const QString& uiConfigName) CAF_ASSERT(!m_lineEdit.isNull()); CAF_ASSERT(!m_label.isNull()); - 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->setToolTip(field()->uiToolTip(uiConfigName)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_lineEdit->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_lineEdit->setToolTip(field()->uiToolTip(uiConfigName)); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp index 66851a01b5..086a051809 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp @@ -161,21 +161,9 @@ void PdmUiLineEditor::configureAndUpdateUi(const QString& uiConfigName) { if (!m_label.isNull()) { - 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->setToolTip(field()->uiToolTip(uiConfigName)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); } - if (!m_lineEdit.isNull()) { bool isReadOnly = field()->isUiReadOnly(uiConfigName); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp index 1b8e725f8c..513a9a8329 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp @@ -162,19 +162,7 @@ void PdmUiListEditor::configureAndUpdateUi(const QString& uiConfigName) CAF_ASSERT(!m_label.isNull()); CAF_ASSERT(m_listView->selectionModel()); - QIcon ic = field()->uiIcon(uiConfigName); - if (!ic.isNull()) - { - m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64)))); - } - else - { - QString uiName = field()->uiName(uiConfigName); - m_label->setText(uiName); - } - - m_label->setEnabled(!field()->isUiReadOnly(uiConfigName)); - m_label->setToolTip(field()->uiToolTip(uiConfigName)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_listView->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_listView->setToolTip(field()->uiToolTip(uiConfigName)); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp index f90a9eed22..f013cdd39d 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp @@ -62,22 +62,11 @@ void PdmUiPushButtonEditor::configureAndUpdateUi(const QString& uiConfigName) CAF_ASSERT(!m_pushButton.isNull()); CAF_ASSERT(!m_label.isNull()); - 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)); - } + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_pushButton->setCheckable(true); - - //m_label->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_pushButton->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_pushButton->setToolTip(field()->uiToolTip(uiConfigName)); - m_label->setToolTip(field()->uiToolTip(uiConfigName)); PdmUiPushButtonEditorAttribute attributes; caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject()); @@ -115,7 +104,6 @@ void PdmUiPushButtonEditor::configureAndUpdateUi(const QString& uiConfigName) } } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -140,14 +128,12 @@ QWidget* PdmUiPushButtonEditor::createLabelWidget(QWidget * parent) //-------------------------------------------------------------------------------------------------- void PdmUiPushButtonEditor::slotClicked(bool checked) { - if (field() && dynamic_cast *> (field()->fieldHandle())) { QVariant v; v = checked; this->setValueToField(v); } - } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp index 392cdba6eb..84ee3e291f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp @@ -63,18 +63,7 @@ void PdmUiSliderEditor::configureAndUpdateUi(const QString& uiConfigName) { CAF_ASSERT(!m_spinBox.isNull()); - 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->setToolTip(field()->uiToolTip(uiConfigName)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_spinBox->setEnabled(!field()->isUiReadOnly(uiConfigName)); m_spinBox->setToolTip(field()->uiToolTip(uiConfigName)); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp index 0c78490d83..7c64651a98 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp @@ -84,18 +84,7 @@ void PdmUiTextEditor::configureAndUpdateUi(const QString& uiConfigName) CAF_ASSERT(!m_textEdit.isNull()); CAF_ASSERT(!m_label.isNull()); - 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->setToolTip(field()->uiToolTip(uiConfigName)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); m_textEdit->setReadOnly(field()->isUiReadOnly(uiConfigName)); //m_textEdit->setEnabled(!field()->isUiReadOnly(uiConfigName)); // Neccesary ? diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index 9df5bade18..6a1f6a02b0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -77,19 +77,7 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi(const QString& uiConfigName) // Label CAF_ASSERT(!m_label.isNull()); - QIcon ic = field()->uiIcon(uiConfigName); - if (!ic.isNull()) - { - m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64)))); - } - else - { - QString uiName = field()->uiName(uiConfigName); - m_label->setText(uiName); - } - - m_label->setEnabled(!field()->isUiReadOnly(uiConfigName)); - m_label->setToolTip(field()->uiToolTip(uiConfigName)); + PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName); // Tree view