mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 15:26:48 -06:00
Fixed clang-format with proper definition file
This commit is contained in:
parent
d93b43afbe
commit
245d3ad287
@ -3,8 +3,8 @@
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2017 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:
|
||||
// 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
|
||||
@ -12,12 +12,12 @@
|
||||
// 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
|
||||
// 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.
|
||||
// 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
|
||||
@ -25,17 +25,26 @@
|
||||
// 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
|
||||
// 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.
|
||||
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
#include "cafPdmUiTimeEditor.h"
|
||||
|
||||
#include "cafFactory.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiDefaultObjectEditor.h"
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafQShortenedLabel.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGridLayout>
|
||||
#include <QIntValidator>
|
||||
@ -47,75 +56,69 @@
|
||||
#include <QStatusBar>
|
||||
#include <QString>
|
||||
|
||||
#include "cafFactory.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiDefaultObjectEditor.h"
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafQShortenedLabel.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
namespace caf {
|
||||
|
||||
namespace caf
|
||||
{
|
||||
CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiTimeEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTimeEditor::configureAndUpdateUi(const QString& uiConfigName) {
|
||||
CAF_ASSERT(!m_timeEdit.isNull());
|
||||
void PdmUiTimeEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
CAF_ASSERT(!m_timeEdit.isNull());
|
||||
|
||||
PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName);
|
||||
PdmUiFieldEditorHandle::updateLabelFromField(m_label, uiConfigName);
|
||||
|
||||
m_timeEdit->setEnabled(!uiField()->isUiReadOnly(uiConfigName));
|
||||
m_timeEdit->setEnabled(!uiField()->isUiReadOnly(uiConfigName));
|
||||
|
||||
caf::PdmUiObjectHandle* uiObject =
|
||||
uiObj(uiField()->fieldHandle()->ownerObject());
|
||||
if (uiObject) {
|
||||
uiObject->editorAttribute(uiField()->fieldHandle(), uiConfigName,
|
||||
&m_attributes);
|
||||
}
|
||||
caf::PdmUiObjectHandle* uiObject = uiObj(uiField()->fieldHandle()->ownerObject());
|
||||
if (uiObject)
|
||||
{
|
||||
uiObject->editorAttribute(uiField()->fieldHandle(), uiConfigName, &m_attributes);
|
||||
}
|
||||
|
||||
if (!m_attributes.timeFormat.isEmpty()) {
|
||||
m_timeEdit->setDisplayFormat(m_attributes.timeFormat);
|
||||
}
|
||||
if (!m_attributes.timeFormat.isEmpty())
|
||||
{
|
||||
m_timeEdit->setDisplayFormat(m_attributes.timeFormat);
|
||||
}
|
||||
|
||||
m_timeEdit->setTime(uiField()->uiValue().toTime());
|
||||
m_timeEdit->setTime(uiField()->uiValue().toTime());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiTimeEditor::createEditorWidget(QWidget* parent) {
|
||||
m_timeEdit = new QTimeEdit(parent);
|
||||
connect(m_timeEdit, SIGNAL(editingFinished()), this,
|
||||
SLOT(slotEditingFinished()));
|
||||
connect(m_timeEdit, SIGNAL(timeChanged(QTime)), this,
|
||||
SLOT(slotTimeChanged(QTime)));
|
||||
return m_timeEdit;
|
||||
QWidget* PdmUiTimeEditor::createEditorWidget(QWidget* parent)
|
||||
{
|
||||
m_timeEdit = new QTimeEdit(parent);
|
||||
connect(m_timeEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
|
||||
connect(m_timeEdit, SIGNAL(timeChanged(QTime)), this, SLOT(slotTimeChanged(QTime)));
|
||||
return m_timeEdit;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiTimeEditor::createLabelWidget(QWidget* parent) {
|
||||
m_label = new QShortenedLabel(parent);
|
||||
return m_label;
|
||||
QWidget* PdmUiTimeEditor::createLabelWidget(QWidget* parent)
|
||||
{
|
||||
m_label = new QShortenedLabel(parent);
|
||||
return m_label;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTimeEditor::slotEditingFinished() {
|
||||
this->setValueToField(m_timeEdit->time());
|
||||
void PdmUiTimeEditor::slotEditingFinished()
|
||||
{
|
||||
this->setValueToField(m_timeEdit->time());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTimeEditor::slotTimeChanged(const QTime& time) {
|
||||
this->setValueToField(m_timeEdit->time());
|
||||
void PdmUiTimeEditor::slotTimeChanged(const QTime& time)
|
||||
{
|
||||
this->setValueToField(m_timeEdit->time());
|
||||
}
|
||||
|
||||
} // end namespace caf
|
||||
} // end namespace caf
|
||||
|
@ -3,8 +3,8 @@
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2019- 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:
|
||||
// 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
|
||||
@ -12,12 +12,12 @@
|
||||
// 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
|
||||
// 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.
|
||||
// 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
|
||||
@ -25,63 +25,65 @@
|
||||
// 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
|
||||
// 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.
|
||||
// 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"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QTimeEdit>
|
||||
#include <QWidget>
|
||||
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
|
||||
namespace caf {
|
||||
|
||||
namespace caf
|
||||
{
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class PdmUiTimeEditorAttribute : public PdmUiEditorAttribute {
|
||||
public:
|
||||
QString timeFormat;
|
||||
class PdmUiTimeEditorAttribute : public PdmUiEditorAttribute
|
||||
{
|
||||
public:
|
||||
QString timeFormat;
|
||||
|
||||
public:
|
||||
PdmUiTimeEditorAttribute() {}
|
||||
public:
|
||||
PdmUiTimeEditorAttribute() {}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class PdmUiTimeEditor : public PdmUiFieldEditorHandle {
|
||||
Q_OBJECT
|
||||
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
|
||||
class PdmUiTimeEditor : public PdmUiFieldEditorHandle
|
||||
{
|
||||
Q_OBJECT
|
||||
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
|
||||
|
||||
public:
|
||||
PdmUiTimeEditor() {}
|
||||
~PdmUiTimeEditor() override {}
|
||||
public:
|
||||
PdmUiTimeEditor() {}
|
||||
~PdmUiTimeEditor() override {}
|
||||
|
||||
protected:
|
||||
QWidget* createEditorWidget(QWidget* parent) override;
|
||||
QWidget* createLabelWidget(QWidget* parent) override;
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
protected:
|
||||
QWidget* createEditorWidget(QWidget* parent) override;
|
||||
QWidget* createLabelWidget(QWidget* parent) override;
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
|
||||
protected slots:
|
||||
void slotEditingFinished();
|
||||
void slotTimeChanged(const QTime& time);
|
||||
protected slots:
|
||||
void slotEditingFinished();
|
||||
void slotTimeChanged(const QTime& time);
|
||||
|
||||
private:
|
||||
QPointer<QTimeEdit> m_timeEdit;
|
||||
QPointer<QShortenedLabel> m_label;
|
||||
private:
|
||||
QPointer<QTimeEdit> m_timeEdit;
|
||||
QPointer<QShortenedLabel> m_label;
|
||||
|
||||
PdmUiTimeEditorAttribute m_attributes;
|
||||
PdmUiTimeEditorAttribute m_attributes;
|
||||
};
|
||||
|
||||
} // end namespace caf
|
||||
} // end namespace caf
|
||||
|
Loading…
Reference in New Issue
Block a user