diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp index 7c2cb1ca0d..eb93e9b21a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp @@ -40,8 +40,10 @@ #include "cafPdmUiCommandSystemProxy.h" #include "cafPdmUiFieldHandle.h" #include "cafPdmUiObjectHandle.h" +#include "cafQShortenedLabel.h" #include +#include #include namespace caf diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h index 5587792a66..d96d41b8a8 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.h @@ -38,7 +38,8 @@ #include "cafClassTypeName.h" #include "cafFactory.h" #include "cafPdmUiEditorHandle.h" -#include "cafQShortenedLabel.h" + +class QLabel; namespace caf { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp index a32ebb70ad..4d1860153b 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.cpp @@ -36,6 +36,8 @@ #include "cafQShortenedLabel.h" #include +#include +#include #include using namespace caf; @@ -142,6 +144,35 @@ void QShortenedLabel::resizeEvent( QResizeEvent* event ) QLabel::resizeEvent( event ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void QShortenedLabel::configureContextMenu( const QString& pythonParameterName ) +{ + setContextMenuPolicy( Qt::CustomContextMenu ); + + auto createContextMenu = [pythonParameterName]( const QPoint& pos ) + { + QMenu menu; + QAction* action = menu.addAction( "Copy Python Parameter Name" ); + action->setIcon( QIcon( ":/caf/duplicate.svg" ) ); + + connect( action, + &QAction::triggered, + [pythonParameterName]() + { + if ( QClipboard* clipboard = QApplication::clipboard() ) + { + clipboard->setText( pythonParameterName ); + } + } ); + + menu.exec( QCursor::pos() ); + }; + + connect( this, &QLabel::customContextMenuRequested, this, createContextMenu ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h index 2837d92f4c..b3c1d5f0cb 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafQShortenedLabel.h @@ -51,6 +51,8 @@ public: QSize minimumSizeHint() const override; QSize sizeHint() const override; + void configureContextMenu( const QString& pythonParameterName ); + protected: void resizeEvent( QResizeEvent* event ) override; void resizeText( QSize paintSize ); diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt index fc64500a6b..cacb20031d 100644 --- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt @@ -180,6 +180,8 @@ set(PROJECT_FILES cafUiIconFactory.cpp cafPdmUiSliderTools.h cafPdmUiSliderTools.cpp + cafPdmUiFieldLabelEditorHandle.h + cafPdmUiFieldLabelEditorHandle.cpp ) add_library( @@ -194,6 +196,8 @@ endif() target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(${PROJECT_NAME} cafProjectDataModel ${QT_LIBRARIES}) +target_link_libraries( + ${PROJECT_NAME} cafProjectDataModel cafPdmScripting ${QT_LIBRARIES} +) source_group("" FILES ${PROJECT_FILES}) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h index 00370136af..39989c78ad 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiActionPushButtonEditor.h @@ -78,15 +78,13 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - // QWidget* createLabelWidget(QWidget * parent) override; - void configureAndUpdateUi( const QString& uiConfigName ) override; + void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotClicked( bool checked ); private: QPointer m_pushButton; - // QPointer m_label; QPointer m_buttonLayout; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp index 4092b50f8c..d81910cc8a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.cpp @@ -115,15 +115,6 @@ QWidget* PdmUiCheckBoxAndTextEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiCheckBoxAndTextEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h index 0b4e809f60..19504a5a4c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxAndTextEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -50,7 +50,7 @@ namespace caf //================================================================================================== /// //================================================================================================== -class PdmUiCheckBoxAndTextEditor : public PdmUiFieldEditorHandle +class PdmUiCheckBoxAndTextEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -61,16 +61,14 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotSetValueToField(); private: - QPointer m_lineEdit; - QPointer m_checkBox; - QPointer m_label; + QPointer m_lineEdit; + QPointer m_checkBox; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp index 48cf6ff17b..ed5b43fd20 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxEditor.cpp @@ -38,11 +38,11 @@ #include "cafPdmUiDefaultObjectEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiFieldEditorHandle.h" - -#include "cafFactory.h" +#include "cafQShortenedLabel.h" namespace caf { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp index fd3749b7d9..adf27b40c8 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp @@ -2,13 +2,11 @@ #include "cafPdmUiCheckBoxTristateEditor.h" -#include "cafPdmUiDefaultObjectEditor.h" - +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" +#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" - -#include "cafFactory.h" #include "cafTristate.h" namespace caf @@ -56,15 +54,6 @@ QWidget* PdmUiCheckBoxTristateEditor::createEditorWidget( QWidget* parent ) return m_checkBox; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiCheckBoxTristateEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h index 9ae955b777..297a063031 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h @@ -2,7 +2,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -11,7 +11,7 @@ namespace caf { -class PdmUiCheckBoxTristateEditor : public PdmUiFieldEditorHandle +class PdmUiCheckBoxTristateEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -22,15 +22,13 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotClicked( bool ); private: - QPointer m_checkBox; - QPointer m_label; + QPointer m_checkBox; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp index 34f46ec044..52057497d8 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.cpp @@ -38,12 +38,11 @@ #include "cafPdmUiDefaultObjectEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include #include @@ -167,15 +166,6 @@ QWidget* PdmUiColorEditor::createEditorWidget( QWidget* parent ) return placeholder; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiColorEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h index 24ae589621..1867ed1d3d 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiColorEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -67,7 +67,7 @@ public: //================================================================================================== /// See cafPdmFieldCvfColor for conversion between cvf::Color3f and QColor //================================================================================================== -class PdmUiColorEditor : public PdmUiFieldEditorHandle +class PdmUiColorEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -80,7 +80,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; QMargins calculateLabelContentMargins() const override; @@ -93,8 +92,6 @@ private: QColor getFontColor( const QColor& backgroundColor ) const; private: - QPointer m_label; - QColor m_color; QPointer m_colorTextLabel; QPointer m_colorSelectionButton; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index b4b04b74fb..11d504fdfc 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -399,15 +399,6 @@ QWidget* PdmUiComboBoxEditor::createEditorWidget( QWidget* parent ) return m_placeholder; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiComboBoxEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h index 16ef2ed06e..adac7873ce 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -90,7 +90,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiComboBoxEditor : public PdmUiFieldEditorHandle +class PdmUiComboBoxEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -101,7 +101,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; QMargins calculateLabelContentMargins() const override; @@ -114,8 +113,7 @@ protected slots: void slotApplyAutoValue(); private: - QPointer m_comboBox; - QPointer m_label; + QPointer m_comboBox; QPointer m_previousItemButton; QPointer m_nextItemButton; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp index 8d1a1d4c2b..873a721490 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.cpp @@ -96,15 +96,6 @@ QWidget* PdmUiDateEditor::createEditorWidget( QWidget* parent ) return m_dateEdit; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiDateEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h index 21ac72edaf..a3e5db1570 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDateEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -61,7 +61,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiDateEditor : public PdmUiFieldEditorHandle +class PdmUiDateEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -72,15 +72,13 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotEditingFinished(); private: - QPointer m_dateEdit; - QPointer m_label; + QPointer m_dateEdit; PdmUiDateEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp index 78573a8605..a7679574ea 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp @@ -42,6 +42,7 @@ #include #include +#include namespace caf { @@ -123,15 +124,6 @@ QWidget* PdmUiDoubleSliderEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiDoubleSliderEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h index 34c73c5b6b..08df3d2c1c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include "cafPdmUiSliderTools.h" #include @@ -53,7 +53,7 @@ namespace caf //================================================================================================== /// //================================================================================================== -class PdmUiDoubleSliderEditor : public PdmUiFieldEditorHandle +class PdmUiDoubleSliderEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -65,7 +65,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; protected slots: void slotEditingFinished(); @@ -76,10 +75,9 @@ private: void writeValueToField( double value ); private: - QPointer m_lineEdit; - QPointer m_slider; - QPointer m_label; - double m_sliderValue; + QPointer m_lineEdit; + QPointer m_slider; + double m_sliderValue; PdmUiDoubleSliderEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp index cf0607a388..60e59871a7 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.cpp @@ -36,13 +36,12 @@ #include "cafPdmUiDoubleValueEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include #include @@ -126,15 +125,6 @@ QWidget* PdmUiDoubleValueEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiDoubleValueEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h index 6c208a2397..f29392ac05 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleValueEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -90,7 +90,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiDoubleValueEditor : public PdmUiFieldEditorHandle +class PdmUiDoubleValueEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -102,7 +102,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; protected slots: void slotEditingFinished(); @@ -111,8 +110,7 @@ private: void writeValueToField(); private: - QPointer m_lineEdit; - QPointer m_label; + QPointer m_lineEdit; PdmUiDoubleValueEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.cpp new file mode 100644 index 0000000000..2c9014c635 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.cpp @@ -0,0 +1,78 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2024 Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafPdmUiFieldLabelEditorHandle.h" +#include "cafPdmAbstractFieldScriptingCapability.h" +#include "cafPdmPythonGenerator.h" +#include "cafPdmUiFieldHandle.h" +#include "cafQShortenedLabel.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* caf::PdmUiFieldLabelEditorHandle::createLabelWidget( QWidget* parent ) +{ + m_label = createLabel( parent, this ); + + return m_label; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::QShortenedLabel* caf::PdmUiFieldLabelEditorHandle::createLabel( QWidget* parent, + caf::PdmUiFieldEditorHandle* uiFieldEditorHandle ) +{ + auto label = new caf::QShortenedLabel( parent ); + + if ( uiFieldEditorHandle && uiFieldEditorHandle->uiField() && uiFieldEditorHandle->uiField()->fieldHandle() ) + { + if ( auto scriptingCapability = + uiFieldEditorHandle->uiField()->fieldHandle()->capability() ) + { + auto scriptFieldName = scriptingCapability->scriptFieldName(); + QString pythonParameterName = caf::PdmPythonGenerator::camelToSnakeCase( scriptFieldName ); + if ( !pythonParameterName.isEmpty() ) + { + label->configureContextMenu( pythonParameterName ); + } + } + } + + return label; +} diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.h new file mode 100644 index 0000000000..61aefd6478 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldLabelEditorHandle.h @@ -0,0 +1,62 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2024 Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafPdmUiFieldEditorHandle.h" + +class QWidget; +class QLabel; + +namespace caf +{ +class QShortenedLabel; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class PdmUiFieldLabelEditorHandle : public PdmUiFieldEditorHandle +{ +public: + QWidget* createLabelWidget( QWidget* parent ) final; + +private: + static QShortenedLabel* createLabel( QWidget* parent, caf::PdmUiFieldEditorHandle* uiFieldEditorHandle ); + +protected: + QPointer m_label; +}; +} // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp index b2acbd40dc..8c87e6d4f1 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp @@ -118,15 +118,6 @@ QWidget* PdmUiFilePathEditor::createEditorWidget( QWidget* parent ) return placeholder; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiFilePathEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h index 8871258010..e8a88675d0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -78,7 +78,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiFilePathEditor : public PdmUiFieldEditorHandle +class PdmUiFilePathEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -89,7 +89,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: @@ -98,10 +97,9 @@ protected slots: void copyToClipboard(); private: - QPointer m_lineEdit; - QPointer m_label; - QPointer m_button; - QPointer m_copyToClipboardButton; + QPointer m_lineEdit; + QPointer m_button; + QPointer m_copyToClipboardButton; PdmUiFilePathEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp index 028c560a2d..4cdb3bc8b0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.cpp @@ -39,6 +39,7 @@ #include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldHandle.h" #include "cafPdmUiObjectHandle.h" +#include "cafQShortenedLabel.h" namespace caf { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h index ad4091884a..13b607b4f3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLabelEditor.h @@ -37,7 +37,6 @@ #pragma once #include "cafPdmUiFieldEditorHandle.h" -#include "cafQShortenedLabel.h" #include #include diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp index e41572017f..90221584c0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp @@ -115,15 +115,6 @@ QWidget* PdmUiLineEditor::createEditorWidget( QWidget* parent ) return m_lineEdit; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiLineEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h index 5f9c8811b5..d22f96d4cb 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -115,7 +115,7 @@ private: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiLineEditor : public PdmUiFieldEditorHandle +class PdmUiLineEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -131,7 +131,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; QMargins calculateLabelContentMargins() const override; @@ -146,8 +145,7 @@ private: bool isMultipleFieldsWithSameKeywordSelected( PdmFieldHandle* editorField ) const; protected: - QPointer m_lineEdit; - QPointer m_label; + QPointer m_lineEdit; QPointer m_autoValueToolButton; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp index 28b063300c..92d913e17f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp @@ -288,15 +288,6 @@ QWidget* PdmUiListEditor::createEditorWidget( QWidget* parent ) return m_listView; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiListEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -523,4 +514,16 @@ bool PdmUiListEditor::isMultiRowEditor() const return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmUiListEditorAttribute::PdmUiListEditorAttribute() + : heightHint( 2000 ) + , allowHorizontalScrollBar( true ) +{ + QPalette myPalette; + + baseColor = myPalette.color( QPalette::Active, QPalette::Base ); +} + } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h index d343c106e4..b80094847a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include @@ -53,14 +53,7 @@ namespace caf class PdmUiListEditorAttribute : public PdmUiEditorAttribute { public: - PdmUiListEditorAttribute() - : heightHint( 2000 ) - , allowHorizontalScrollBar( true ) - { - QPalette myPalette; - - baseColor = myPalette.color( QPalette::Active, QPalette::Base ); - } + PdmUiListEditorAttribute(); public: QColor baseColor; @@ -72,7 +65,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiListEditor : public PdmUiFieldEditorHandle +class PdmUiListEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -83,7 +76,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; bool eventFilter( QObject* listView, QEvent* event ) override; // To catch delete key press in list view. bool isMultiRowEditor() const override; @@ -101,7 +93,6 @@ private: private: QPointer m_listView; - QPointer m_label; QPointer m_model; bool m_isEditOperationsAvailable; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp index 6c889f3534..909e3d3c95 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp @@ -36,14 +36,12 @@ #include "cafPdmUiPushButtonEditor.h" -#include "cafPdmUiDefaultObjectEditor.h" - +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" +#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include @@ -171,15 +169,6 @@ QWidget* PdmUiPushButtonEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiPushButtonEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h index 269c80a97a..fdc8648d6b 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -60,7 +60,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiPushButtonEditor : public PdmUiFieldEditorHandle +class PdmUiPushButtonEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -74,16 +74,14 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: void slotClicked( bool checked ); private: - QPointer m_pushButton; - QPointer m_label; - QPointer m_buttonLayout; + QPointer m_pushButton; + QPointer m_buttonLayout; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp index f3140d4518..317edf1380 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.cpp @@ -36,13 +36,12 @@ #include "cafPdmUiSliderEditor.h" +#include "cafFactory.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafFactory.h" - #include #include #include @@ -120,15 +119,6 @@ QWidget* PdmUiSliderEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiSliderEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h index 8f76eb660d..ad273135fd 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiSliderEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -69,7 +69,7 @@ public: int m_step; }; -class PdmUiSliderEditor : public PdmUiFieldEditorHandle +class PdmUiSliderEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -81,7 +81,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; protected slots: void slotSliderValueChanged( int position ); @@ -92,9 +91,8 @@ private: void writeValueToField(); private: - QPointer m_spinBox; - QPointer m_slider; - QPointer m_label; + QPointer m_spinBox; + QPointer m_slider; PdmUiSliderEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp index 55adc2893c..797c32f473 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp @@ -42,6 +42,7 @@ #include "cafPdmUiEditorHandle.h" #include "cafPdmUiTableViewDelegate.h" #include "cafPdmUiTableViewQModel.h" +#include "cafQShortenedLabel.h" #include "cafSelectionManager.h" #include diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h index b95cab8712..c0c81fee3a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h @@ -163,8 +163,8 @@ private slots: private: friend class FocusEventHandler; - QPointer m_tableHeading; - QPointer m_tableHeadingIcon; + QPointer m_tableHeading; + QPointer m_tableHeadingIcon; TableView* m_tableView; PdmUiTableViewQModel* m_tableModelPdm; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp index 52d065c87a..0718b558a9 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.cpp @@ -208,15 +208,6 @@ QWidget* PdmUiTextEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiTextEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h index 570d79e4d3..d33a570016 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTextEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -112,7 +112,7 @@ private: //================================================================================================== /// An editor to show (and possibly edit?) formatted larger portions of text //================================================================================================== -class PdmUiTextEditor : public PdmUiFieldEditorHandle +class PdmUiTextEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -123,7 +123,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; bool isMultiRowEditor() const override; @@ -134,9 +133,8 @@ private: QTextOption::WrapMode toQTextOptionWrapMode( PdmUiTextEditorAttribute::WrapMode wrapMode ); private: - QPointer m_textEdit; - QPointer m_saveButton; - QPointer m_label; + QPointer m_textEdit; + QPointer m_saveButton; PdmUiTextEditorAttribute::TextMode m_textMode; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp index 6b68545df1..17b9e42f96 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.cpp @@ -94,15 +94,6 @@ QWidget* PdmUiTimeEditor::createEditorWidget( QWidget* parent ) return m_timeEdit; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiTimeEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h index 41f9a6b18a..e92ce58cd2 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTimeEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include #include @@ -60,7 +60,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiTimeEditor : public PdmUiFieldEditorHandle +class PdmUiTimeEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -71,7 +71,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; protected slots: @@ -79,8 +78,7 @@ protected slots: void slotTimeChanged( const QTime& time ); private: - QPointer m_timeEdit; - QPointer m_label; + QPointer m_timeEdit; PdmUiTimeEditorAttribute m_attributes; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index 14db565afe..76433d45b3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -382,15 +382,6 @@ QWidget* PdmUiTreeSelectionEditor::createEditorWidget( QWidget* parent ) return frame; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiTreeSelectionEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h index 32edc020a2..5d6fca4316 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h @@ -35,7 +35,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include @@ -92,7 +92,7 @@ public: //================================================================================================== /// //================================================================================================== -class PdmUiTreeSelectionEditor : public PdmUiFieldEditorHandle +class PdmUiTreeSelectionEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -104,7 +104,6 @@ public: protected: void configureAndUpdateUi( const QString& uiConfigName ) override; QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; QMargins calculateLabelContentMargins() const override; bool isMultiRowEditor() const override; @@ -142,7 +141,6 @@ private: private: QPointer m_treeView; - QPointer m_label; QPointer m_toggleAllCheckBox; QPointer m_textFilterLineEdit; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp index 8c86f63aad..8ce6abc2c4 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.cpp @@ -287,13 +287,4 @@ QWidget* PdmUiValueRangeEditor::createEditorWidget( QWidget* parent ) return containerWidget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* PdmUiValueRangeEditor::createLabelWidget( QWidget* parent ) -{ - m_label = new QShortenedLabel( parent ); - return m_label; -} - } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h index 20cabef17d..0032275ef4 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiValueRangeEditor.h @@ -36,7 +36,7 @@ #pragma once -#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiFieldLabelEditorHandle.h" #include "cafPdmUiSliderTools.h" class QLineEdit; @@ -46,7 +46,7 @@ namespace caf //================================================================================================== /// //================================================================================================== -class PdmUiValueRangeEditor : public PdmUiFieldEditorHandle +class PdmUiValueRangeEditor : public PdmUiFieldLabelEditorHandle { Q_OBJECT CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; @@ -57,7 +57,6 @@ public: protected: QWidget* createEditorWidget( QWidget* parent ) override; - QWidget* createLabelWidget( QWidget* parent ) override; void configureAndUpdateUi( const QString& uiConfigName ) override; private slots: @@ -78,9 +77,8 @@ private: QPointer m_lineEditMax; QPointer m_sliderMax; - QPointer m_label; - double m_sliderValueMin; - double m_sliderValueMax; + double m_sliderValueMin; + double m_sliderValueMax; PdmUiDoubleSliderEditorAttribute m_attributes; };