mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add option for word wrap in label and checkbox
* Add support for word wrap in checkbox label * QLabelEditor: Add word wrap and support for wide label Add support for one label widget spanning the area usually consumed by a label widget and an editor widget. * Use word wrap in summary calculation dialog
This commit is contained in:
@@ -36,6 +36,10 @@
|
||||
|
||||
#include "cafPdmUiLabelEditor.h"
|
||||
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiFieldHandle.h"
|
||||
#include "cafPdmUiObjectHandle.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT( PdmUiLabelEditor );
|
||||
@@ -64,6 +68,27 @@ void PdmUiLabelEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
PdmUiFieldEditorHandle::updateLabelFromField( m_label, uiConfigName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiLabelEditor::createCombinedWidget( QWidget* parent )
|
||||
{
|
||||
caf::PdmUiObjectHandle* uiObject = uiObj( uiField()->fieldHandle()->ownerObject() );
|
||||
if ( uiObject )
|
||||
{
|
||||
const QString uiConfigName;
|
||||
PdmUiLabelEditorAttribute attributes;
|
||||
uiObject->editorAttribute( uiField()->fieldHandle(), uiConfigName, &attributes );
|
||||
|
||||
if ( attributes.m_useSingleWidgetInsteadOfLabelAndEditorWidget )
|
||||
{
|
||||
return createLabelWidget( parent );
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -79,7 +104,23 @@ QWidget* PdmUiLabelEditor::createLabelWidget( QWidget* parent )
|
||||
{
|
||||
if ( m_label.isNull() )
|
||||
{
|
||||
m_label = new QShortenedLabel( parent );
|
||||
PdmUiLabelEditorAttribute attributes;
|
||||
caf::PdmUiObjectHandle* uiObject = uiObj( uiField()->fieldHandle()->ownerObject() );
|
||||
if ( uiObject )
|
||||
{
|
||||
const QString uiConfigName;
|
||||
uiObject->editorAttribute( uiField()->fieldHandle(), uiConfigName, &attributes );
|
||||
}
|
||||
|
||||
if ( attributes.m_useWordWrap )
|
||||
{
|
||||
m_label = new QLabel( parent );
|
||||
m_label->setWordWrap( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_label = new QShortenedLabel( parent );
|
||||
}
|
||||
}
|
||||
|
||||
return m_label;
|
||||
|
||||
Reference in New Issue
Block a user