mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Whitespace
This commit is contained in:
parent
24bda0fda2
commit
735bd5a4b1
@ -1,29 +1,53 @@
|
||||
|
||||
#include "ManyGroups.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(ManyGroups, "LargeObject");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ManyGroups::ManyGroups()
|
||||
{
|
||||
CAF_PDM_InitObject("Many Groups", ":/images/win/filenew.png", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework");
|
||||
CAF_PDM_InitObject("Many Groups",
|
||||
":/images/win/filenew.png",
|
||||
"This object is a demo of the CAF framework",
|
||||
"This object is a demo of the CAF framework");
|
||||
|
||||
CAF_PDM_InitField(&m_toggleField, "Toggle", false, "Add Items To Multi Select", "", "Toggle Field tooltip", " Toggle Field whatsthis");
|
||||
CAF_PDM_InitField(&m_doubleField, "BigNumber", 0.0, "Big Number", "", "Enter a big number here", "This is a place you can enter a big real value if you want");
|
||||
CAF_PDM_InitField(&m_intField, "IntNumber", 0, "Small Number", "", "Enter some small number here", "This is a place you can enter a small integer value if you want");
|
||||
CAF_PDM_InitField(&m_textField, "TextField", QString(""), "Text", "", "Text tooltip", "This is a place you can enter a small integer value if you want");
|
||||
CAF_PDM_InitField(
|
||||
&m_toggleField, "Toggle", false, "Add Items To Multi Select", "", "Toggle Field tooltip", " Toggle Field whatsthis");
|
||||
CAF_PDM_InitField(&m_doubleField,
|
||||
"BigNumber",
|
||||
0.0,
|
||||
"Big Number",
|
||||
"",
|
||||
"Enter a big number here",
|
||||
"This is a place you can enter a big real value if you want");
|
||||
CAF_PDM_InitField(&m_intField,
|
||||
"IntNumber",
|
||||
0,
|
||||
"Small Number",
|
||||
"",
|
||||
"Enter some small number here",
|
||||
"This is a place you can enter a small integer value if you want");
|
||||
CAF_PDM_InitField(&m_textField,
|
||||
"TextField",
|
||||
QString(""),
|
||||
"Text",
|
||||
"",
|
||||
"Text tooltip",
|
||||
"This is a place you can enter a small integer value if you want");
|
||||
|
||||
m_proxyDoubleField.registerSetMethod(this, &ManyGroups::setDoubleMember);
|
||||
m_proxyDoubleField.registerGetMethod(this, &ManyGroups::doubleMember);
|
||||
CAF_PDM_InitFieldNoDefault(&m_proxyDoubleField, "ProxyDouble", "Proxy Double", "", "", "");
|
||||
|
||||
m_proxyDoubleField = 0;
|
||||
if (!(m_proxyDoubleField == 3)) { std::cout << "Double is not 3 " << std::endl; }
|
||||
if (!(m_proxyDoubleField == 3))
|
||||
{
|
||||
std::cout << "Double is not 3 " << std::endl;
|
||||
}
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_multiSelectList, "SelectedItems", "Multi Select Field", "", "", "");
|
||||
m_multiSelectList.uiCapability()->setAutoAddingOptionFromValue(false);
|
||||
@ -36,8 +60,9 @@ ManyGroups::ManyGroups()
|
||||
m_multiSelectList.v().push_back("Second");
|
||||
m_multiSelectList.v().push_back("Third");
|
||||
|
||||
CAF_PDM_InitField(&m_singleStringWithManySelectableItems, "m_singleStringWithManySelectableItems", QString(""), "Text with many items", "", "Text tooltip", "");
|
||||
m_singleStringWithManySelectableItems.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitField(
|
||||
&m_stringWithMultipleOptions, "m_stringWithMultipleOptions", QString(""), "Text with many items", "", "", "");
|
||||
m_stringWithMultipleOptions.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -62,12 +87,13 @@ void ManyGroups::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> ManyGroups::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
QList<caf::PdmOptionItemInfo> ManyGroups::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
// Test code used to switch between two lists with different content, but same item count
|
||||
if (fieldNeedingOptions == &m_singleStringWithManySelectableItems)
|
||||
if (fieldNeedingOptions == &m_stringWithMultipleOptions)
|
||||
{
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
@ -120,7 +146,8 @@ QList<caf::PdmOptionItemInfo> ManyGroups::calculateValueOptions(const caf::PdmFi
|
||||
|
||||
{
|
||||
text = "Second_b";
|
||||
caf::PdmOptionItemInfo itemInfo = caf::PdmOptionItemInfo(text, text, false, QIcon(QString(":/images/win/filenew.png")));
|
||||
caf::PdmOptionItemInfo itemInfo =
|
||||
caf::PdmOptionItemInfo(text, text, false, QIcon(QString(":/images/win/filenew.png")));
|
||||
itemInfo.setLevel(1);
|
||||
options.push_back(itemInfo);
|
||||
}
|
||||
@ -207,7 +234,9 @@ void ManyGroups::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void ManyGroups::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
void ManyGroups::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &m_multiSelectList)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
caf::PdmProxyValueField<double> m_proxyDoubleField;
|
||||
|
||||
caf::PdmField<std::vector<QString> > m_multiSelectList;
|
||||
caf::PdmField<QString> m_singleStringWithManySelectableItems;
|
||||
caf::PdmField<QString> m_stringWithMultipleOptions;
|
||||
|
||||
caf::PdmField<bool> m_toggleField;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#include "cafPdmUiFormLayoutObjectEditor.h"
|
||||
|
||||
#include "cafPdmObjectHandle.h"
|
||||
@ -57,10 +56,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmUiFormLayoutObjectEditor::PdmUiFormLayoutObjectEditor()
|
||||
{
|
||||
|
||||
}
|
||||
caf::PdmUiFormLayoutObjectEditor::PdmUiFormLayoutObjectEditor() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -115,7 +111,8 @@ void caf::PdmUiFormLayoutObjectEditor::recursivelyConfigureAndUpdateUiOrderingIn
|
||||
PdmUiOrdering::LayoutOptions currentLayout = uiItemsInRow[i].second;
|
||||
|
||||
int minimumItemColumnSpan = 0, minimumLabelColumnSpan = 0, minimumFieldColumnSpan = 0;
|
||||
uiOrdering.nrOfColumnsRequiredForItem(uiItemsInRow[i], &minimumItemColumnSpan, &minimumLabelColumnSpan, &minimumFieldColumnSpan);
|
||||
uiOrdering.nrOfColumnsRequiredForItem(
|
||||
uiItemsInRow[i], &minimumItemColumnSpan, &minimumLabelColumnSpan, &minimumFieldColumnSpan);
|
||||
bool isExpandingItem = currentLayout.totalColumnSpan == PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN;
|
||||
|
||||
int spareColumnsToAssign = 0;
|
||||
@ -129,9 +126,13 @@ void caf::PdmUiFormLayoutObjectEditor::recursivelyConfigureAndUpdateUiOrderingIn
|
||||
|
||||
if (currentItem->isUiGroup())
|
||||
{
|
||||
recursivelyAddGroupToGridLayout(currentItem, containerWidgetWithGridLayout,
|
||||
uiConfigName, parentLayout, currentRowIndex,
|
||||
currentColumn, itemColumnSpan);
|
||||
recursivelyAddGroupToGridLayout(currentItem,
|
||||
containerWidgetWithGridLayout,
|
||||
uiConfigName,
|
||||
parentLayout,
|
||||
currentRowIndex,
|
||||
currentColumn,
|
||||
itemColumnSpan);
|
||||
currentColumn += itemColumnSpan;
|
||||
}
|
||||
else
|
||||
@ -199,7 +200,8 @@ void caf::PdmUiFormLayoutObjectEditor::recursivelyConfigureAndUpdateUiOrderingIn
|
||||
spareColumnsToAssign -= spareColumnsToAssign / 2;
|
||||
}
|
||||
|
||||
parentLayout->addWidget(fieldLabelWidget, currentRowIndex, currentColumn, 1, leftLabelColumnSpan, Qt::AlignTop);
|
||||
parentLayout->addWidget(
|
||||
fieldLabelWidget, currentRowIndex, currentColumn, 1, leftLabelColumnSpan, Qt::AlignTop);
|
||||
currentColumn += leftLabelColumnSpan;
|
||||
|
||||
// Apply margins determined by the editor type
|
||||
@ -214,7 +216,8 @@ void caf::PdmUiFormLayoutObjectEditor::recursivelyConfigureAndUpdateUiOrderingIn
|
||||
CAF_ASSERT(fieldColumnSpan >= 1 && "Need at least one column for the field");
|
||||
fieldColumnSpan = std::max(1, fieldColumnSpan);
|
||||
|
||||
parentLayout->addWidget(fieldEditorWidget, currentRowIndex, currentColumn, 1, fieldColumnSpan, Qt::AlignTop);
|
||||
parentLayout->addWidget(
|
||||
fieldEditorWidget, currentRowIndex, currentColumn, 1, fieldColumnSpan, Qt::AlignTop);
|
||||
currentColumn += fieldColumnSpan;
|
||||
}
|
||||
|
||||
@ -279,7 +282,8 @@ bool caf::PdmUiFormLayoutObjectEditor::isUiGroupExpanded(const PdmUiGroup* uiGro
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QMinimizePanel* caf::PdmUiFormLayoutObjectEditor::findOrCreateGroupBox(QWidget* parent, PdmUiGroup* group, const QString& uiConfigName)
|
||||
QMinimizePanel*
|
||||
caf::PdmUiFormLayoutObjectEditor::findOrCreateGroupBox(QWidget* parent, PdmUiGroup* group, const QString& uiConfigName)
|
||||
{
|
||||
QString groupBoxKey = group->keyword();
|
||||
QMinimizePanel* groupBox = nullptr;
|
||||
@ -327,7 +331,9 @@ QMinimizePanel* caf::PdmUiFormLayoutObjectEditor::findOrCreateGroupBox(QWidget*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmUiFieldEditorHandle* caf::PdmUiFormLayoutObjectEditor::findOrCreateFieldEditor(QWidget* parent, PdmUiFieldHandle* field, const QString& uiConfigName)
|
||||
caf::PdmUiFieldEditorHandle* caf::PdmUiFormLayoutObjectEditor::findOrCreateFieldEditor(QWidget* parent,
|
||||
PdmUiFieldHandle* field,
|
||||
const QString& uiConfigName)
|
||||
{
|
||||
caf::PdmUiFieldEditorHandle* fieldEditor = nullptr;
|
||||
|
||||
@ -531,4 +537,3 @@ void caf::PdmUiFormLayoutObjectEditor::recursiveVerifyUniqueNames(const std::vec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user