mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-20 11:48:35 -06:00
Add support for specifying date format for UI date fields
This commit is contained in:
parent
fd6b491075
commit
e5772d15f9
@ -85,6 +85,17 @@ void PdmUiDateEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
|
||||
m_dateEdit->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
|
||||
caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject());
|
||||
if (uiObject)
|
||||
{
|
||||
uiObject->editorAttribute(field()->fieldHandle(), uiConfigName, &m_attributes);
|
||||
}
|
||||
|
||||
if (!m_attributes.dateFormat.isEmpty())
|
||||
{
|
||||
m_dateEdit->setDisplayFormat(m_attributes.dateFormat);
|
||||
}
|
||||
|
||||
m_dateEdit->setDate(field()->uiValue().toDate());
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,20 @@
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class PdmUiDateEditorAttribute : public PdmUiEditorAttribute
|
||||
{
|
||||
public:
|
||||
QString dateFormat;
|
||||
|
||||
public:
|
||||
PdmUiDateEditorAttribute()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -69,8 +83,10 @@ protected slots:
|
||||
void slotEditingFinished();
|
||||
|
||||
private:
|
||||
QPointer<QDateEdit> m_dateEdit;
|
||||
QPointer<QLabel> m_label;
|
||||
QPointer<QDateEdit> m_dateEdit;
|
||||
QPointer<QLabel> m_label;
|
||||
|
||||
PdmUiDateEditorAttribute m_attributes;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user