mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'refs/remotes/origin/dev'
Conflicts: ApplicationCode/ProjectDataModel/CMakeLists_files.cmake
This commit is contained in:
commit
cc5f5eddd0
@ -85,6 +85,8 @@ ${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimNamedObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplateCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFracture.h
|
||||
@ -180,6 +182,8 @@ ${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimNamedObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplateCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFracture.cpp
|
||||
|
61
ApplicationCode/ProjectDataModel/RimCheckableNamedObject.cpp
Normal file
61
ApplicationCode/ProjectDataModel/RimCheckableNamedObject.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimCheckableNamedObject, "CheckableNamedObject"); // Do not use. Abstract class
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCheckableNamedObject::RimCheckableNamedObject(void)
|
||||
{
|
||||
CAF_PDM_InitField(&m_isChecked, "IsChecked", true, "Active", "", "", "");
|
||||
m_isChecked.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCheckableNamedObject::~RimCheckableNamedObject(void)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCheckableNamedObject::isChecked() const
|
||||
{
|
||||
return m_isChecked();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCheckableNamedObject::setCheckState(bool checkState)
|
||||
{
|
||||
m_isChecked = checkState;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCheckableNamedObject::objectToggleField()
|
||||
{
|
||||
return &m_isChecked;
|
||||
}
|
43
ApplicationCode/ProjectDataModel/RimCheckableNamedObject.h
Normal file
43
ApplicationCode/ProjectDataModel/RimCheckableNamedObject.h
Normal file
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimNamedObject.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimCheckableNamedObject : public RimNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimCheckableNamedObject(void);
|
||||
virtual ~RimCheckableNamedObject(void);
|
||||
|
||||
bool isChecked() const;
|
||||
void setCheckState(bool checkState);
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isChecked;
|
||||
};
|
||||
|
61
ApplicationCode/ProjectDataModel/RimNamedObject.cpp
Normal file
61
ApplicationCode/ProjectDataModel/RimNamedObject.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimNamedObject.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimNamedObject, "NamedObject"); // Do not use. Abstract class
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimNamedObject::RimNamedObject(void)
|
||||
{
|
||||
CAF_PDM_InitField(&m_name, "Name", QString(), "Name", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimNamedObject::~RimNamedObject(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimNamedObject::name() const
|
||||
{
|
||||
return m_name();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimNamedObject::setName(const QString& name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimNamedObject::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
}
|
46
ApplicationCode/ProjectDataModel/RimNamedObject.h
Normal file
46
ApplicationCode/ProjectDataModel/RimNamedObject.h
Normal file
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimNamedObject : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimNamedObject(void);
|
||||
virtual ~RimNamedObject(void);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString& name);
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
};
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QStringList>
|
||||
#include <QTabWidget>
|
||||
#include <QWidget>
|
||||
#include <QDebug>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -39,9 +40,10 @@ RiuPropertyViewTabWidget::RiuPropertyViewTabWidget(QWidget* parent, caf::PdmObje
|
||||
|
||||
for (int i = 0; i < uiConfigNameForTabs.size(); i++)
|
||||
{
|
||||
// Use a container widget to get some UI space around a PdmUiPropertyView
|
||||
QWidget* containerWidget = new QWidget;
|
||||
QHBoxLayout* widgetLayout = new QHBoxLayout;
|
||||
widgetLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QWidget* containerWidget = new QWidget;
|
||||
containerWidget->setLayout(widgetLayout);
|
||||
|
||||
caf::PdmUiPropertyView* pdmUiPropertyView = new caf::PdmUiPropertyView();
|
||||
@ -60,7 +62,6 @@ RiuPropertyViewTabWidget::RiuPropertyViewTabWidget(QWidget* parent, caf::PdmObje
|
||||
|
||||
dialogLayout->addWidget(tabWidget);
|
||||
|
||||
|
||||
// Buttons
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
@ -79,3 +80,24 @@ RiuPropertyViewTabWidget::~RiuPropertyViewTabWidget()
|
||||
w->showProperties(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuPropertyViewTabWidget::sizeHint() const
|
||||
{
|
||||
QSize maxSizeHint = QDialog::sizeHint();
|
||||
//qDebug() << "dialog size hint : " << maxSizeHint;
|
||||
|
||||
for (auto w : m_pageWidgets)
|
||||
{
|
||||
//qDebug() << "tab size hint" << w->sizeHint();
|
||||
|
||||
QSize pageSize = w->sizeHint();
|
||||
pageSize += QSize(0, 100);
|
||||
|
||||
maxSizeHint = maxSizeHint.expandedTo(pageSize);
|
||||
}
|
||||
|
||||
return maxSizeHint;
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ public:
|
||||
RiuPropertyViewTabWidget(QWidget* parent, caf::PdmObject* object, const QString& windowTitle, const QStringList& uiConfigNameForTabs);
|
||||
~RiuPropertyViewTabWidget();
|
||||
|
||||
virtual QSize sizeHint() const override;
|
||||
|
||||
private:
|
||||
std::vector<caf::PdmUiPropertyView*> m_pageWidgets;
|
||||
};
|
||||
|
@ -47,13 +47,14 @@ public:
|
||||
|
||||
// Virtual interface to override in subclasses to support special behaviour if needed
|
||||
public: // Virtual
|
||||
virtual PdmFieldHandle* userDescriptionField() { return NULL; }
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return NULL; }
|
||||
|
||||
/// Field used to toggle object on/off in UI-related uses of the object (ie checkbox in treeview)
|
||||
virtual PdmFieldHandle* objectToggleField() { return NULL; }
|
||||
virtual caf::PdmFieldHandle* objectToggleField() { return NULL; }
|
||||
|
||||
/// Method to reimplement to catch when the field has changed due to setUiValue()
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) {}
|
||||
|
||||
/// Method to re-implement to supply option values for a specific field
|
||||
virtual QList<PdmOptionItemInfo>
|
||||
calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { return QList<PdmOptionItemInfo>(); }
|
||||
|
@ -174,7 +174,12 @@ PdmObjectHandle* PdmUiPropertyView::currentObject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize PdmUiPropertyView::sizeHint() const
|
||||
{
|
||||
return QSize(200, 200);
|
||||
if (m_placeholder)
|
||||
{
|
||||
return m_placeholder->sizeHint();
|
||||
}
|
||||
|
||||
return QWidget::sizeHint();
|
||||
}
|
||||
|
||||
} //End of namespace caf
|
||||
|
Loading…
Reference in New Issue
Block a user