Extract creation of QShortenedLabel and add context menu

Create an intermediate class used to create a QShortenedLabel. If field is scriptable, add a context menu to support copy of the Python field name to clipboard.
This commit is contained in:
Magne Sjaastad 2024-11-25 07:16:42 +01:00
parent ddefd39fc2
commit 494175d1e6
45 changed files with 264 additions and 263 deletions

View File

@ -40,8 +40,10 @@
#include "cafPdmUiCommandSystemProxy.h" #include "cafPdmUiCommandSystemProxy.h"
#include "cafPdmUiFieldHandle.h" #include "cafPdmUiFieldHandle.h"
#include "cafPdmUiObjectHandle.h" #include "cafPdmUiObjectHandle.h"
#include "cafQShortenedLabel.h"
#include <QAbstractScrollArea> #include <QAbstractScrollArea>
#include <QLabel>
#include <QMenu> #include <QMenu>
namespace caf namespace caf

View File

@ -38,7 +38,8 @@
#include "cafClassTypeName.h" #include "cafClassTypeName.h"
#include "cafFactory.h" #include "cafFactory.h"
#include "cafPdmUiEditorHandle.h" #include "cafPdmUiEditorHandle.h"
#include "cafQShortenedLabel.h"
class QLabel;
namespace caf namespace caf
{ {

View File

@ -36,6 +36,8 @@
#include "cafQShortenedLabel.h" #include "cafQShortenedLabel.h"
#include <QApplication> #include <QApplication>
#include <QClipboard>
#include <QMenu>
#include <QResizeEvent> #include <QResizeEvent>
using namespace caf; using namespace caf;
@ -142,6 +144,35 @@ void QShortenedLabel::resizeEvent( QResizeEvent* event )
QLabel::resizeEvent( 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 );
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -51,6 +51,8 @@ public:
QSize minimumSizeHint() const override; QSize minimumSizeHint() const override;
QSize sizeHint() const override; QSize sizeHint() const override;
void configureContextMenu( const QString& pythonParameterName );
protected: protected:
void resizeEvent( QResizeEvent* event ) override; void resizeEvent( QResizeEvent* event ) override;
void resizeText( QSize paintSize ); void resizeText( QSize paintSize );

View File

@ -180,6 +180,8 @@ set(PROJECT_FILES
cafUiIconFactory.cpp cafUiIconFactory.cpp
cafPdmUiSliderTools.h cafPdmUiSliderTools.h
cafPdmUiSliderTools.cpp cafPdmUiSliderTools.cpp
cafPdmUiFieldLabelEditorHandle.h
cafPdmUiFieldLabelEditorHandle.cpp
) )
add_library( add_library(
@ -194,6 +196,8 @@ endif()
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 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}) source_group("" FILES ${PROJECT_FILES})

View File

@ -78,15 +78,13 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
// QWidget* createLabelWidget(QWidget * parent) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override;
protected slots: protected slots:
void slotClicked( bool checked ); void slotClicked( bool checked );
private: private:
QPointer<QPushButton> m_pushButton; QPointer<QPushButton> m_pushButton;
// QPointer<QShortenedLabel> m_label;
QPointer<QHBoxLayout> m_buttonLayout; QPointer<QHBoxLayout> m_buttonLayout;
}; };

View File

@ -115,15 +115,6 @@ QWidget* PdmUiCheckBoxAndTextEditor::createEditorWidget( QWidget* parent )
return containerWidget; return containerWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiCheckBoxAndTextEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QCheckBox> #include <QCheckBox>
#include <QLabel> #include <QLabel>
@ -50,7 +50,7 @@ namespace caf
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiCheckBoxAndTextEditor : public PdmUiFieldEditorHandle class PdmUiCheckBoxAndTextEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -61,16 +61,14 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
protected slots: protected slots:
void slotSetValueToField(); void slotSetValueToField();
private: private:
QPointer<QLineEdit> m_lineEdit; QPointer<QLineEdit> m_lineEdit;
QPointer<QCheckBox> m_checkBox; QPointer<QCheckBox> m_checkBox;
QPointer<QShortenedLabel> m_label;
}; };
} // end namespace caf } // end namespace caf

View File

@ -38,11 +38,11 @@
#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiDefaultObjectEditor.h"
#include "cafFactory.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafQShortenedLabel.h"
#include "cafFactory.h"
namespace caf namespace caf
{ {

View File

@ -2,13 +2,11 @@
#include "cafPdmUiCheckBoxTristateEditor.h" #include "cafPdmUiCheckBoxTristateEditor.h"
#include "cafPdmUiDefaultObjectEditor.h" #include "cafFactory.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiDefaultObjectEditor.h"
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafFactory.h"
#include "cafTristate.h" #include "cafTristate.h"
namespace caf namespace caf
@ -56,15 +54,6 @@ QWidget* PdmUiCheckBoxTristateEditor::createEditorWidget( QWidget* parent )
return m_checkBox; return m_checkBox;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiCheckBoxTristateEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QCheckBox> #include <QCheckBox>
#include <QLabel> #include <QLabel>
@ -11,7 +11,7 @@
namespace caf namespace caf
{ {
class PdmUiCheckBoxTristateEditor : public PdmUiFieldEditorHandle class PdmUiCheckBoxTristateEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -22,15 +22,13 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
protected slots: protected slots:
void slotClicked( bool ); void slotClicked( bool );
private: private:
QPointer<QCheckBox> m_checkBox; QPointer<QCheckBox> m_checkBox;
QPointer<QShortenedLabel> m_label;
}; };
} // end namespace caf } // end namespace caf

View File

@ -38,12 +38,11 @@
#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiDefaultObjectEditor.h"
#include "cafFactory.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafFactory.h"
#include <QApplication> #include <QApplication>
#include <QColor> #include <QColor>
#include <QColorDialog> #include <QColorDialog>
@ -167,15 +166,6 @@ QWidget* PdmUiColorEditor::createEditorWidget( QWidget* parent )
return placeholder; return placeholder;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiColorEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
@ -67,7 +67,7 @@ public:
//================================================================================================== //==================================================================================================
/// See cafPdmFieldCvfColor for conversion between cvf::Color3f and QColor /// See cafPdmFieldCvfColor for conversion between cvf::Color3f and QColor
//================================================================================================== //==================================================================================================
class PdmUiColorEditor : public PdmUiFieldEditorHandle class PdmUiColorEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -80,7 +80,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
QMargins calculateLabelContentMargins() const override; QMargins calculateLabelContentMargins() const override;
@ -93,8 +92,6 @@ private:
QColor getFontColor( const QColor& backgroundColor ) const; QColor getFontColor( const QColor& backgroundColor ) const;
private: private:
QPointer<QShortenedLabel> m_label;
QColor m_color; QColor m_color;
QPointer<QLabel> m_colorTextLabel; QPointer<QLabel> m_colorTextLabel;
QPointer<QToolButton> m_colorSelectionButton; QPointer<QToolButton> m_colorSelectionButton;

View File

@ -399,15 +399,6 @@ QWidget* PdmUiComboBoxEditor::createEditorWidget( QWidget* parent )
return m_placeholder; return m_placeholder;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiComboBoxEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QComboBox> #include <QComboBox>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -90,7 +90,7 @@ public:
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiComboBoxEditor : public PdmUiFieldEditorHandle class PdmUiComboBoxEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -101,7 +101,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
QMargins calculateLabelContentMargins() const override; QMargins calculateLabelContentMargins() const override;
@ -114,8 +113,7 @@ protected slots:
void slotApplyAutoValue(); void slotApplyAutoValue();
private: private:
QPointer<QComboBox> m_comboBox; QPointer<QComboBox> m_comboBox;
QPointer<QShortenedLabel> m_label;
QPointer<QToolButton> m_previousItemButton; QPointer<QToolButton> m_previousItemButton;
QPointer<QToolButton> m_nextItemButton; QPointer<QToolButton> m_nextItemButton;

View File

@ -96,15 +96,6 @@ QWidget* PdmUiDateEditor::createEditorWidget( QWidget* parent )
return m_dateEdit; return m_dateEdit;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDateEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QDateTimeEdit> #include <QDateTimeEdit>
#include <QLabel> #include <QLabel>
@ -61,7 +61,7 @@ public:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class PdmUiDateEditor : public PdmUiFieldEditorHandle class PdmUiDateEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -72,15 +72,13 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
protected slots: protected slots:
void slotEditingFinished(); void slotEditingFinished();
private: private:
QPointer<QDateTimeEdit> m_dateEdit; QPointer<QDateTimeEdit> m_dateEdit;
QPointer<QShortenedLabel> m_label;
PdmUiDateEditorAttribute m_attributes; PdmUiDateEditorAttribute m_attributes;
}; };

View File

@ -42,6 +42,7 @@
#include <QDoubleValidator> #include <QDoubleValidator>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel>
namespace caf namespace caf
{ {
@ -123,15 +124,6 @@ QWidget* PdmUiDoubleSliderEditor::createEditorWidget( QWidget* parent )
return containerWidget; return containerWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDoubleSliderEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include "cafPdmUiSliderTools.h" #include "cafPdmUiSliderTools.h"
#include <QLabel> #include <QLabel>
@ -53,7 +53,7 @@ namespace caf
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiDoubleSliderEditor : public PdmUiFieldEditorHandle class PdmUiDoubleSliderEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -65,7 +65,6 @@ public:
protected: protected:
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
protected slots: protected slots:
void slotEditingFinished(); void slotEditingFinished();
@ -76,10 +75,9 @@ private:
void writeValueToField( double value ); void writeValueToField( double value );
private: private:
QPointer<QLineEdit> m_lineEdit; QPointer<QLineEdit> m_lineEdit;
QPointer<QSlider> m_slider; QPointer<QSlider> m_slider;
QPointer<QShortenedLabel> m_label; double m_sliderValue;
double m_sliderValue;
PdmUiDoubleSliderEditorAttribute m_attributes; PdmUiDoubleSliderEditorAttribute m_attributes;
}; };

View File

@ -36,13 +36,12 @@
#include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiDoubleValueEditor.h"
#include "cafFactory.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiDefaultObjectEditor.h"
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafFactory.h"
#include <QDoubleValidator> #include <QDoubleValidator>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
@ -126,15 +125,6 @@ QWidget* PdmUiDoubleValueEditor::createEditorWidget( QWidget* parent )
return containerWidget; return containerWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDoubleValueEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QDoubleValidator> #include <QDoubleValidator>
#include <QGroupBox> #include <QGroupBox>
@ -90,7 +90,7 @@ public:
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiDoubleValueEditor : public PdmUiFieldEditorHandle class PdmUiDoubleValueEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -102,7 +102,6 @@ public:
protected: protected:
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
protected slots: protected slots:
void slotEditingFinished(); void slotEditingFinished();
@ -111,8 +110,7 @@ private:
void writeValueToField(); void writeValueToField();
private: private:
QPointer<QLineEdit> m_lineEdit; QPointer<QLineEdit> m_lineEdit;
QPointer<QShortenedLabel> m_label;
PdmUiDoubleValueEditorAttribute m_attributes; PdmUiDoubleValueEditorAttribute m_attributes;
}; };

View File

@ -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 <<http://www.gnu.org/licenses/gpl.html>>
// 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 <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "cafPdmUiFieldLabelEditorHandle.h"
#include "cafPdmAbstractFieldScriptingCapability.h"
#include "cafPdmPythonGenerator.h"
#include "cafPdmUiFieldHandle.h"
#include "cafQShortenedLabel.h"
#include <QWidget>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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<caf::PdmAbstractFieldScriptingCapability>() )
{
auto scriptFieldName = scriptingCapability->scriptFieldName();
QString pythonParameterName = caf::PdmPythonGenerator::camelToSnakeCase( scriptFieldName );
if ( !pythonParameterName.isEmpty() )
{
label->configureContextMenu( pythonParameterName );
}
}
}
return label;
}

View File

@ -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 <<http://www.gnu.org/licenses/gpl.html>>
// 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 <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// 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<QLabel> m_label;
};
} // end namespace caf

View File

@ -118,15 +118,6 @@ QWidget* PdmUiFilePathEditor::createEditorWidget( QWidget* parent )
return placeholder; return placeholder;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiFilePathEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
@ -78,7 +78,7 @@ public:
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiFilePathEditor : public PdmUiFieldEditorHandle class PdmUiFilePathEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -89,7 +89,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
protected slots: protected slots:
@ -98,10 +97,9 @@ protected slots:
void copyToClipboard(); void copyToClipboard();
private: private:
QPointer<QLineEdit> m_lineEdit; QPointer<QLineEdit> m_lineEdit;
QPointer<QShortenedLabel> m_label; QPointer<QToolButton> m_button;
QPointer<QToolButton> m_button; QPointer<QToolButton> m_copyToClipboardButton;
QPointer<QToolButton> m_copyToClipboardButton;
PdmUiFilePathEditorAttribute m_attributes; PdmUiFilePathEditorAttribute m_attributes;
}; };

View File

@ -39,6 +39,7 @@
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafPdmUiFieldHandle.h" #include "cafPdmUiFieldHandle.h"
#include "cafPdmUiObjectHandle.h" #include "cafPdmUiObjectHandle.h"
#include "cafQShortenedLabel.h"
namespace caf namespace caf
{ {

View File

@ -37,7 +37,6 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafQShortenedLabel.h"
#include <QLabel> #include <QLabel>
#include <QPointer> #include <QPointer>

View File

@ -115,15 +115,6 @@ QWidget* PdmUiLineEditor::createEditorWidget( QWidget* parent )
return m_lineEdit; return m_lineEdit;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiLineEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
@ -115,7 +115,7 @@ private:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class PdmUiLineEditor : public PdmUiFieldEditorHandle class PdmUiLineEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -131,7 +131,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
QMargins calculateLabelContentMargins() const override; QMargins calculateLabelContentMargins() const override;
@ -146,8 +145,7 @@ private:
bool isMultipleFieldsWithSameKeywordSelected( PdmFieldHandle* editorField ) const; bool isMultipleFieldsWithSameKeywordSelected( PdmFieldHandle* editorField ) const;
protected: protected:
QPointer<PdmUiLineEdit> m_lineEdit; QPointer<PdmUiLineEdit> m_lineEdit;
QPointer<QShortenedLabel> m_label;
QPointer<QToolButton> m_autoValueToolButton; QPointer<QToolButton> m_autoValueToolButton;

View File

@ -288,15 +288,6 @@ QWidget* PdmUiListEditor::createEditorWidget( QWidget* parent )
return m_listView; 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; return true;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
PdmUiListEditorAttribute::PdmUiListEditorAttribute()
: heightHint( 2000 )
, allowHorizontalScrollBar( true )
{
QPalette myPalette;
baseColor = myPalette.color( QPalette::Active, QPalette::Base );
}
} // end namespace caf } // end namespace caf

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QStringListModel> #include <QStringListModel>
@ -53,14 +53,7 @@ namespace caf
class PdmUiListEditorAttribute : public PdmUiEditorAttribute class PdmUiListEditorAttribute : public PdmUiEditorAttribute
{ {
public: public:
PdmUiListEditorAttribute() PdmUiListEditorAttribute();
: heightHint( 2000 )
, allowHorizontalScrollBar( true )
{
QPalette myPalette;
baseColor = myPalette.color( QPalette::Active, QPalette::Base );
}
public: public:
QColor baseColor; QColor baseColor;
@ -72,7 +65,7 @@ public:
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiListEditor : public PdmUiFieldEditorHandle class PdmUiListEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -83,7 +76,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
bool eventFilter( QObject* listView, QEvent* event ) override; // To catch delete key press in list view. bool eventFilter( QObject* listView, QEvent* event ) override; // To catch delete key press in list view.
bool isMultiRowEditor() const override; bool isMultiRowEditor() const override;
@ -101,7 +93,6 @@ private:
private: private:
QPointer<QListViewHeightHint> m_listView; QPointer<QListViewHeightHint> m_listView;
QPointer<QShortenedLabel> m_label;
QPointer<QStringListModel> m_model; QPointer<QStringListModel> m_model;
bool m_isEditOperationsAvailable; bool m_isEditOperationsAvailable;

View File

@ -36,14 +36,12 @@
#include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiDefaultObjectEditor.h" #include "cafFactory.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiDefaultObjectEditor.h"
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafFactory.h"
#include <QBoxLayout> #include <QBoxLayout>
#include <cmath> #include <cmath>
@ -171,15 +169,6 @@ QWidget* PdmUiPushButtonEditor::createEditorWidget( QWidget* parent )
return containerWidget; return containerWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiPushButtonEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QLabel> #include <QLabel>
#include <QPointer> #include <QPointer>
@ -60,7 +60,7 @@ public:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class PdmUiPushButtonEditor : public PdmUiFieldEditorHandle class PdmUiPushButtonEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -74,16 +74,14 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
protected slots: protected slots:
void slotClicked( bool checked ); void slotClicked( bool checked );
private: private:
QPointer<QPushButton> m_pushButton; QPointer<QPushButton> m_pushButton;
QPointer<QShortenedLabel> m_label; QPointer<QHBoxLayout> m_buttonLayout;
QPointer<QHBoxLayout> m_buttonLayout;
}; };
} // end namespace caf } // end namespace caf

View File

@ -36,13 +36,12 @@
#include "cafPdmUiSliderEditor.h" #include "cafPdmUiSliderEditor.h"
#include "cafFactory.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiDefaultObjectEditor.h"
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldEditorHandle.h"
#include "cafFactory.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QIntValidator> #include <QIntValidator>
#include <QLabel> #include <QLabel>
@ -120,15 +119,6 @@ QWidget* PdmUiSliderEditor::createEditorWidget( QWidget* parent )
return containerWidget; return containerWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiSliderEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QGroupBox> #include <QGroupBox>
#include <QLabel> #include <QLabel>
@ -69,7 +69,7 @@ public:
int m_step; int m_step;
}; };
class PdmUiSliderEditor : public PdmUiFieldEditorHandle class PdmUiSliderEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -81,7 +81,6 @@ public:
protected: protected:
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
protected slots: protected slots:
void slotSliderValueChanged( int position ); void slotSliderValueChanged( int position );
@ -92,9 +91,8 @@ private:
void writeValueToField(); void writeValueToField();
private: private:
QPointer<QSpinBox> m_spinBox; QPointer<QSpinBox> m_spinBox;
QPointer<QSlider> m_slider; QPointer<QSlider> m_slider;
QPointer<QShortenedLabel> m_label;
PdmUiSliderEditorAttribute m_attributes; PdmUiSliderEditorAttribute m_attributes;
}; };

View File

@ -42,6 +42,7 @@
#include "cafPdmUiEditorHandle.h" #include "cafPdmUiEditorHandle.h"
#include "cafPdmUiTableViewDelegate.h" #include "cafPdmUiTableViewDelegate.h"
#include "cafPdmUiTableViewQModel.h" #include "cafPdmUiTableViewQModel.h"
#include "cafQShortenedLabel.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include <QApplication> #include <QApplication>

View File

@ -163,8 +163,8 @@ private slots:
private: private:
friend class FocusEventHandler; friend class FocusEventHandler;
QPointer<QShortenedLabel> m_tableHeading; QPointer<QLabel> m_tableHeading;
QPointer<QLabel> m_tableHeadingIcon; QPointer<QLabel> m_tableHeadingIcon;
TableView* m_tableView; TableView* m_tableView;
PdmUiTableViewQModel* m_tableModelPdm; PdmUiTableViewQModel* m_tableModelPdm;

View File

@ -208,15 +208,6 @@ QWidget* PdmUiTextEditor::createEditorWidget( QWidget* parent )
return containerWidget; return containerWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiTextEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QLabel> #include <QLabel>
#include <QPointer> #include <QPointer>
@ -112,7 +112,7 @@ private:
//================================================================================================== //==================================================================================================
/// An editor to show (and possibly edit?) formatted larger portions of text /// An editor to show (and possibly edit?) formatted larger portions of text
//================================================================================================== //==================================================================================================
class PdmUiTextEditor : public PdmUiFieldEditorHandle class PdmUiTextEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -123,7 +123,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
bool isMultiRowEditor() const override; bool isMultiRowEditor() const override;
@ -134,9 +133,8 @@ private:
QTextOption::WrapMode toQTextOptionWrapMode( PdmUiTextEditorAttribute::WrapMode wrapMode ); QTextOption::WrapMode toQTextOptionWrapMode( PdmUiTextEditorAttribute::WrapMode wrapMode );
private: private:
QPointer<TextEdit> m_textEdit; QPointer<TextEdit> m_textEdit;
QPointer<QPushButton> m_saveButton; QPointer<QPushButton> m_saveButton;
QPointer<QShortenedLabel> m_label;
PdmUiTextEditorAttribute::TextMode m_textMode; PdmUiTextEditorAttribute::TextMode m_textMode;
}; };

View File

@ -94,15 +94,6 @@ QWidget* PdmUiTimeEditor::createEditorWidget( QWidget* parent )
return m_timeEdit; return m_timeEdit;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiTimeEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QPointer> #include <QPointer>
#include <QString> #include <QString>
@ -60,7 +60,7 @@ public:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class PdmUiTimeEditor : public PdmUiFieldEditorHandle class PdmUiTimeEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -71,7 +71,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
protected slots: protected slots:
@ -79,8 +78,7 @@ protected slots:
void slotTimeChanged( const QTime& time ); void slotTimeChanged( const QTime& time );
private: private:
QPointer<QTimeEdit> m_timeEdit; QPointer<QTimeEdit> m_timeEdit;
QPointer<QShortenedLabel> m_label;
PdmUiTimeEditorAttribute m_attributes; PdmUiTimeEditorAttribute m_attributes;
}; };

View File

@ -382,15 +382,6 @@ QWidget* PdmUiTreeSelectionEditor::createEditorWidget( QWidget* parent )
return frame; return frame;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiTreeSelectionEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -35,7 +35,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include <QAbstractItemModel> #include <QAbstractItemModel>
@ -92,7 +92,7 @@ public:
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiTreeSelectionEditor : public PdmUiFieldEditorHandle class PdmUiTreeSelectionEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -104,7 +104,6 @@ public:
protected: protected:
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
QMargins calculateLabelContentMargins() const override; QMargins calculateLabelContentMargins() const override;
bool isMultiRowEditor() const override; bool isMultiRowEditor() const override;
@ -142,7 +141,6 @@ private:
private: private:
QPointer<QTreeViewHeightHint> m_treeView; QPointer<QTreeViewHeightHint> m_treeView;
QPointer<QShortenedLabel> m_label;
QPointer<QCheckBox> m_toggleAllCheckBox; QPointer<QCheckBox> m_toggleAllCheckBox;
QPointer<QLineEdit> m_textFilterLineEdit; QPointer<QLineEdit> m_textFilterLineEdit;

View File

@ -287,13 +287,4 @@ QWidget* PdmUiValueRangeEditor::createEditorWidget( QWidget* parent )
return containerWidget; return containerWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiValueRangeEditor::createLabelWidget( QWidget* parent )
{
m_label = new QShortenedLabel( parent );
return m_label;
}
} // end namespace caf } // end namespace caf

View File

@ -36,7 +36,7 @@
#pragma once #pragma once
#include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiFieldLabelEditorHandle.h"
#include "cafPdmUiSliderTools.h" #include "cafPdmUiSliderTools.h"
class QLineEdit; class QLineEdit;
@ -46,7 +46,7 @@ namespace caf
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class PdmUiValueRangeEditor : public PdmUiFieldEditorHandle class PdmUiValueRangeEditor : public PdmUiFieldLabelEditorHandle
{ {
Q_OBJECT Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@ -57,7 +57,6 @@ public:
protected: protected:
QWidget* createEditorWidget( QWidget* parent ) override; QWidget* createEditorWidget( QWidget* parent ) override;
QWidget* createLabelWidget( QWidget* parent ) override;
void configureAndUpdateUi( const QString& uiConfigName ) override; void configureAndUpdateUi( const QString& uiConfigName ) override;
private slots: private slots:
@ -78,9 +77,8 @@ private:
QPointer<QLineEdit> m_lineEditMax; QPointer<QLineEdit> m_lineEditMax;
QPointer<QSlider> m_sliderMax; QPointer<QSlider> m_sliderMax;
QPointer<QShortenedLabel> m_label; double m_sliderValueMin;
double m_sliderValueMin; double m_sliderValueMax;
double m_sliderValueMax;
PdmUiDoubleSliderEditorAttribute m_attributes; PdmUiDoubleSliderEditorAttribute m_attributes;
}; };