mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 14:03:18 -06:00
#1867 AppFwk : Use updateLabelFromField from field editors
This commit is contained in:
parent
2f22f82ba1
commit
a0a28fee36
@ -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));
|
||||
|
||||
|
@ -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));
|
||||
|
@ -46,12 +46,12 @@
|
||||
|
||||
#include "cafFactory.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QColor>
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolButton>
|
||||
#include <QColorDialog>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QToolButton>
|
||||
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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())
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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<PdmField<bool> *> (field()->fieldHandle()))
|
||||
{
|
||||
QVariant v;
|
||||
v = checked;
|
||||
this->setValueToField(v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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 ?
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user