mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-17 16:45:16 -05:00
PdmUiTextEditor. Add attribute for setting wrap mode
This commit is contained in:
@@ -123,6 +123,7 @@ void PdmUiTextEditor::configureAndUpdateUi(const QString& uiConfigName)
|
|||||||
}
|
}
|
||||||
m_textEdit->blockSignals(false);
|
m_textEdit->blockSignals(false);
|
||||||
|
|
||||||
|
m_textEdit->setWordWrapMode(toQTextOptionWrapMode(leab.wrapMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -184,4 +185,20 @@ void PdmUiTextEditor::slotSetValueToField()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QTextOption::WrapMode PdmUiTextEditor::toQTextOptionWrapMode(PdmUiTextEditorAttribute::WrapMode wrapMode)
|
||||||
|
{
|
||||||
|
switch (wrapMode)
|
||||||
|
{
|
||||||
|
case PdmUiTextEditorAttribute::NoWrap: return QTextOption::WrapMode::NoWrap;
|
||||||
|
case PdmUiTextEditorAttribute::WordWrap: return QTextOption::WrapMode::WordWrap;
|
||||||
|
case PdmUiTextEditorAttribute::ManualWrap: return QTextOption::WrapMode::ManualWrap;
|
||||||
|
case PdmUiTextEditorAttribute::WrapAnywhere: return QTextOption::WrapMode::WrapAnywhere;
|
||||||
|
case PdmUiTextEditorAttribute::WrapAtWordBoundaryOrAnywhere:
|
||||||
|
default: return QTextOption::WrapMode::WrapAtWordBoundaryOrAnywhere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
|||||||
@@ -55,10 +55,19 @@ namespace caf
|
|||||||
class PdmUiTextEditorAttribute : public PdmUiEditorAttribute
|
class PdmUiTextEditorAttribute : public PdmUiEditorAttribute
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum WrapMode {
|
||||||
|
NoWrap,
|
||||||
|
WordWrap,
|
||||||
|
ManualWrap,
|
||||||
|
WrapAnywhere,
|
||||||
|
WrapAtWordBoundaryOrAnywhere
|
||||||
|
};
|
||||||
|
|
||||||
PdmUiTextEditorAttribute()
|
PdmUiTextEditorAttribute()
|
||||||
{
|
{
|
||||||
textMode = PLAIN;
|
textMode = PLAIN;
|
||||||
showSaveButton = false;
|
showSaveButton = false;
|
||||||
|
wrapMode = WrapAtWordBoundaryOrAnywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TextMode
|
enum TextMode
|
||||||
@@ -70,6 +79,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
TextMode textMode;
|
TextMode textMode;
|
||||||
bool showSaveButton;
|
bool showSaveButton;
|
||||||
|
WrapMode wrapMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -109,6 +119,9 @@ protected:
|
|||||||
protected slots:
|
protected slots:
|
||||||
void slotSetValueToField();
|
void slotSetValueToField();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTextOption::WrapMode toQTextOptionWrapMode(PdmUiTextEditorAttribute::WrapMode wrapMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<TextEdit> m_textEdit;
|
QPointer<TextEdit> m_textEdit;
|
||||||
QPointer<QPushButton> m_saveButton;
|
QPointer<QPushButton> m_saveButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user