AppFwk : Apply clang-format

This commit is contained in:
Magne Sjaastad 2019-09-20 09:52:12 +02:00
parent b92618ebd3
commit f4cfc750f1
19 changed files with 1025 additions and 839 deletions

View File

@ -43,7 +43,6 @@
#include <QFrame> #include <QFrame>
#include <QGridLayout> #include <QGridLayout>
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
@ -51,8 +50,8 @@ class WidgetCellIds
{ {
public: public:
WidgetCellIds(QWidget* w, const std::vector<int>& occupiedCellIds) WidgetCellIds(QWidget* w, const std::vector<int>& occupiedCellIds)
: m_customWidget(w), : m_customWidget(w)
m_customWidgetCellIds(occupiedCellIds) , m_customWidgetCellIds(occupiedCellIds)
{ {
} }
@ -60,11 +59,8 @@ public:
std::vector<int> m_customWidgetCellIds; std::vector<int> m_customWidgetCellIds;
}; };
namespace caf namespace caf
{ {
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -77,9 +73,7 @@ CustomObjectEditor::CustomObjectEditor()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
CustomObjectEditor::~CustomObjectEditor() CustomObjectEditor::~CustomObjectEditor() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -93,7 +87,12 @@ void CustomObjectEditor::defineGridLayout(int rowCount, int columnCount)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void CustomObjectEditor::addWidget(QWidget* widget, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment /*= 0*/) void CustomObjectEditor::addWidget(QWidget* widget,
int row,
int column,
int rowSpan,
int columnSpan,
Qt::Alignment alignment /*= 0*/)
{ {
CAF_ASSERT(isAreaAvailable(row, column, rowSpan, columnSpan)); CAF_ASSERT(isAreaAvailable(row, column, rowSpan, columnSpan));
@ -151,7 +150,8 @@ QWidget* CustomObjectEditor::createWidget(QWidget* parent)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void CustomObjectEditor::recursivelyConfigureAndUpdateTopLevelUiOrdering(const PdmUiOrdering& topLevelUiOrdering, const QString& uiConfigName) void CustomObjectEditor::recursivelyConfigureAndUpdateTopLevelUiOrdering(const PdmUiOrdering& topLevelUiOrdering,
const QString& uiConfigName)
{ {
resetCellId(); resetCellId();
@ -284,5 +284,4 @@ std::vector<int> CustomObjectEditor::cellIds(int row, int column, int rowSpan, i
return cells; return cells;
} }
} // end namespace caf } // end namespace caf

View File

@ -50,11 +50,9 @@ class WidgetCellIds;
namespace caf namespace caf
{ {
class PdmUiItem; class PdmUiItem;
class PdmUiGroup; class PdmUiGroup;
//================================================================================================== //==================================================================================================
/// Automatically layout top level groups into a grid layout /// Automatically layout top level groups into a grid layout
/// ///
@ -99,6 +97,4 @@ private:
std::vector<WidgetCellIds> m_customWidgetAreas; std::vector<WidgetCellIds> m_customWidgetAreas;
}; };
} // end namespace caf } // end namespace caf

View File

@ -5,17 +5,15 @@
#include "CustomObjectEditor.h" #include "CustomObjectEditor.h"
#include "ManyGroups.h" #include "ManyGroups.h"
#include "WidgetLayoutTest.h"
#include "MenuItemProducer.h" #include "MenuItemProducer.h"
#include "WidgetLayoutTest.h"
#include "cafAppEnum.h" #include "cafAppEnum.h"
#ifdef TAP_USE_COMMAND_FRAMEWORK #ifdef TAP_USE_COMMAND_FRAMEWORK
#include "cafCmdExecCommandManager.h" #include "cafCmdExecCommandManager.h"
#include "cafCmdSelectionHelper.h"
#include "cafCmdFeatureManager.h" #include "cafCmdFeatureManager.h"
#include "cafCmdSelectionHelper.h"
#endif #endif
#include "cafFilePath.h" #include "cafFilePath.h"
@ -27,9 +25,9 @@
#include "cafPdmReferenceHelper.h" #include "cafPdmReferenceHelper.h"
#include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiFilePathEditor.h" #include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiItem.h" #include "cafPdmUiItem.h"
#include "cafPdmUiListEditor.h" #include "cafPdmUiListEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiPropertyView.h" #include "cafPdmUiPropertyView.h"
#include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTableView.h" #include "cafPdmUiTableView.h"
@ -39,25 +37,25 @@
#include "cafPdmUiTreeView.h" #include "cafPdmUiTreeView.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include "cafCmdFeatureMenuBuilder.h"
#include <QAction> #include <QAction>
#include <QDockWidget> #include <QDockWidget>
#include <QFileDialog> #include <QFileDialog>
#include <QMenuBar> #include <QMenuBar>
#include <QTreeView> #include <QTreeView>
#include <QUndoView> #include <QUndoView>
#include "cafCmdFeatureMenuBuilder.h"
class DemoPdmObjectGroup : public caf::PdmDocument class DemoPdmObjectGroup : public caf::PdmDocument
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public:
public:
DemoPdmObjectGroup() DemoPdmObjectGroup()
{ {
CAF_PDM_InitFieldNoDefault(&objects, "PdmObjects", "", "", "", "") CAF_PDM_InitFieldNoDefault(&objects, "PdmObjects", "", "", "", "")
objects.uiCapability()->setUiHidden(true); objects.uiCapability()
->setUiHidden(true);
} }
public: public:
@ -69,18 +67,40 @@ CAF_PDM_SOURCE_INIT(DemoPdmObjectGroup, "DemoPdmObjectGroup");
class SmallDemoPdmObject : public caf::PdmObject class SmallDemoPdmObject : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public:
public:
SmallDemoPdmObject() SmallDemoPdmObject()
{ {
CAF_PDM_InitObject("Small Demo Object", ":/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("Small Demo Object",
":/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(
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" ); &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");
m_doubleField.uiCapability()->setCustomContextMenuEnabled(true); m_doubleField.uiCapability()->setCustomContextMenuEnabled(true);
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_intField,
CAF_PDM_InitField(&m_textField, "TextField", QString(""), "Text", "", "Text tooltip", "This is a place you can enter a small integer value if you want"); "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, &SmallDemoPdmObject::setDoubleMember); m_proxyDoubleField.registerSetMethod(this, &SmallDemoPdmObject::setDoubleMember);
m_proxyDoubleField.registerGetMethod(this, &SmallDemoPdmObject::doubleMember); m_proxyDoubleField.registerGetMethod(this, &SmallDemoPdmObject::doubleMember);
@ -92,7 +112,10 @@ public:
m_fileNameList.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_fileNameList.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_proxyDoubleField = 0; 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", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_multiSelectList, "SelectedItems", "Multi Select Field", "", "", "");
m_multiSelectList.xmlCapability()->setIOReadable(false); m_multiSelectList.xmlCapability()->setIOReadable(false);
@ -104,7 +127,6 @@ public:
m_multiSelectList.v().push_back("Third"); m_multiSelectList.v().push_back("Third");
} }
caf::PdmField<double> m_doubleField; caf::PdmField<double> m_doubleField;
caf::PdmField<int> m_intField; caf::PdmField<int> m_intField;
caf::PdmField<QString> m_textField; caf::PdmField<QString> m_textField;
@ -115,7 +137,6 @@ public:
caf::PdmField<std::vector<QString>> m_multiSelectList; caf::PdmField<std::vector<QString>> m_multiSelectList;
caf::PdmField<bool> m_toggleField; caf::PdmField<bool> m_toggleField;
caf::PdmFieldHandle* objectToggleField() override caf::PdmFieldHandle* objectToggleField() override
{ {
@ -130,14 +151,22 @@ public:
} }
} }
void setDoubleMember(const double& d) { m_doubleMember = d; std::cout << "setDoubleMember" << std::endl; } void setDoubleMember(const double& d)
double doubleMember() const { std::cout << "doubleMember" << std::endl; return m_doubleMember; } {
m_doubleMember = d;
std::cout << "setDoubleMember" << std::endl;
}
double doubleMember() const
{
std::cout << "doubleMember" << std::endl;
return m_doubleMember;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
@ -160,7 +189,8 @@ public:
{ {
text = "Second_b"; text = "Second_b";
caf::PdmOptionItemInfo itemInfo = caf::PdmOptionItemInfo(text, text, false, caf::QIconProvider(":/images/win/filenew.png")); caf::PdmOptionItemInfo itemInfo =
caf::PdmOptionItemInfo(text, text, false, caf::QIconProvider(":/images/win/filenew.png"));
itemInfo.setLevel(1); itemInfo.setLevel(1);
options.push_back(itemInfo); options.push_back(itemInfo);
} }
@ -195,16 +225,12 @@ public:
} }
return options; return options;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget) override
QMenu* menu,
QWidget* fieldEditorWidget) override
{ {
menu->addAction("test"); menu->addAction("test");
menu->addAction("other test <<>>"); menu->addAction("other test <<>>");
@ -231,54 +257,229 @@ protected:
CAF_PDM_SOURCE_INIT(SmallDemoPdmObject, "SmallDemoPdmObject"); CAF_PDM_SOURCE_INIT(SmallDemoPdmObject, "SmallDemoPdmObject");
class SmallGridDemoPdmObject : public caf::PdmObject class SmallGridDemoPdmObject : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public:
public:
SmallGridDemoPdmObject() SmallGridDemoPdmObject()
{ {
CAF_PDM_InitObject("Small Grid Demo Object", "", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework"); CAF_PDM_InitObject("Small Grid Demo Object",
"",
"This object is a demo of the CAF framework",
"This object is a demo of the CAF framework");
CAF_PDM_InitField(&m_intFieldStandard, "Standard", 0, "Standard", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_intFieldStandard,
CAF_PDM_InitField(&m_intFieldUseFullSpace, "FullSpace", 0, "Use Full Space For Both", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "Standard",
CAF_PDM_InitField(&m_intFieldUseFullSpaceLabel, "FullSpaceLabel", 0, "Total 3, Label MAX", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); 0,
CAF_PDM_InitField(&m_intFieldUseFullSpaceField, "FullSpaceField", 0, "Total MAX, Label 1", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "Standard",
CAF_PDM_InitField(&m_intFieldWideLabel,"WideLabel", 0, "Wide Label", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "",
CAF_PDM_InitField(&m_intFieldWideField,"WideField", 0, "Wide Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "Enter some small number here",
CAF_PDM_InitField(&m_intFieldLeft, "LeftField", 0, "Left Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldRight, "RightField", 0, "Right Field With More Text", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_intFieldUseFullSpace,
CAF_PDM_InitField(&m_intFieldWideBoth, "WideBoth", 0, "Wide Both", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "FullSpace",
0,
"Use Full Space For Both",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldUseFullSpaceLabel,
"FullSpaceLabel",
0,
"Total 3, Label MAX",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldUseFullSpaceField,
"FullSpaceField",
0,
"Total MAX, Label 1",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldWideLabel,
"WideLabel",
0,
"Wide Label",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldWideField,
"WideField",
0,
"Wide Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldLeft,
"LeftField",
0,
"Left Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldRight,
"RightField",
0,
"Right Field With More Text",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldWideBoth,
"WideBoth",
0,
"Wide Both",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldWideBoth2, "WideBoth2", 0, "Wide Both", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_intFieldWideBoth2,
CAF_PDM_InitField(&m_intFieldLeft2, "LeftFieldInGrp", 0, "Left Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "WideBoth2",
CAF_PDM_InitField(&m_intFieldCenter, "CenterFieldInGrp", 0, "Center Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); 0,
CAF_PDM_InitField(&m_intFieldRight2, "RightFieldInGrp", 0, "Right Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "Wide Both",
CAF_PDM_InitField(&m_intFieldLabelTop, "FieldLabelTop", 0, "Field Label Top", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldLeft2,
"LeftFieldInGrp",
0,
"Left Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldCenter,
"CenterFieldInGrp",
0,
"Center Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldRight2,
"RightFieldInGrp",
0,
"Right Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldLabelTop,
"FieldLabelTop",
0,
"Field Label Top",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
m_intFieldLabelTop.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_intFieldLabelTop.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&m_stringFieldLabelHidden, "FieldLabelHidden", QString("Hidden Label Field"), "Field Label Hidden", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_stringFieldLabelHidden,
"FieldLabelHidden",
QString("Hidden Label Field"),
"Field Label Hidden",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
m_stringFieldLabelHidden.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_stringFieldLabelHidden.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&m_intFieldWideBothAuto, "WideBothAuto", 0, "Wide ", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_intFieldWideBothAuto,
CAF_PDM_InitField(&m_intFieldLeftAuto, "LeftFieldInGrpAuto", 0, "Left Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "WideBothAuto",
CAF_PDM_InitField(&m_intFieldCenterAuto, "CenterFieldInGrpAuto", 0, "Center Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); 0,
CAF_PDM_InitField(&m_intFieldRightAuto, "RightFieldInGrpAuto", 0, "Right Field", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "Wide ",
CAF_PDM_InitField(&m_intFieldLabelTopAuto, "FieldLabelTopAuto", 0, "Field Label Top", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldLeftAuto,
"LeftFieldInGrpAuto",
0,
"Left Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldCenterAuto,
"CenterFieldInGrpAuto",
0,
"Center Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldRightAuto,
"RightFieldInGrpAuto",
0,
"Right Field",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldLabelTopAuto,
"FieldLabelTopAuto",
0,
"Field Label Top",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
m_intFieldLabelTopAuto.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_intFieldLabelTopAuto.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&m_stringFieldLabelHiddenAuto, "FieldLabelHiddenAuto", QString("Hidden Label Field"), "Field Label Hidden", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_stringFieldLabelHiddenAuto,
"FieldLabelHiddenAuto",
QString("Hidden Label Field"),
"Field Label Hidden",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
m_stringFieldLabelHiddenAuto.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_stringFieldLabelHiddenAuto.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&m_intFieldLeftOfGroup, "FieldLeftOfGrp", 0, "Left of group", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_intFieldLeftOfGroup,
CAF_PDM_InitField(&m_intFieldRightOfGroup, "FieldRightOfGrp", 0, "Right of group wide label", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "FieldLeftOfGrp",
0,
CAF_PDM_InitField(&m_intFieldInsideGroup1, "FieldInGrp1", 0, "Inside Group", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "Left of group",
CAF_PDM_InitField(&m_intFieldInsideGroup2, "FieldInGrp2", 0, "Inside Group", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "",
CAF_PDM_InitField(&m_intFieldInsideGroup3, "FieldInGrp3", 0, "Inside Group", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "Enter some small number here",
CAF_PDM_InitField(&m_intFieldInsideGroup4, "FieldInGrp4", 0, "Inside Group", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldInsideGroup5, "FieldInGrp5", 0, "Inside Group", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); CAF_PDM_InitField(&m_intFieldRightOfGroup,
CAF_PDM_InitField(&m_intFieldInsideGroup6, "FieldInGrp6", 0, "Inside Group", "", "Enter some small number here", "This is a place you can enter a small integer value if you want"); "FieldRightOfGrp",
0,
"Right of group wide label",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldInsideGroup1,
"FieldInGrp1",
0,
"Inside Group",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldInsideGroup2,
"FieldInGrp2",
0,
"Inside Group",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldInsideGroup3,
"FieldInGrp3",
0,
"Inside Group",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldInsideGroup4,
"FieldInGrp4",
0,
"Inside Group",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldInsideGroup5,
"FieldInGrp5",
0,
"Inside Group",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_intFieldInsideGroup6,
"FieldInGrp6",
0,
"Inside Group",
"",
"Enter some small number here",
"This is a place you can enter a small integer value if you want");
} }
// Outside group // Outside group
@ -327,9 +528,14 @@ protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override
{ {
uiOrdering.add(&m_intFieldStandard); uiOrdering.add(&m_intFieldStandard);
uiOrdering.add(&m_intFieldUseFullSpace, caf::PdmUiOrdering::LayoutOptions(true, caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN, caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN)); uiOrdering.add(&m_intFieldUseFullSpace,
uiOrdering.add(&m_intFieldUseFullSpaceLabel, caf::PdmUiOrdering::LayoutOptions(true, 3, caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN)); caf::PdmUiOrdering::LayoutOptions(true,
uiOrdering.add(&m_intFieldUseFullSpaceField, caf::PdmUiOrdering::LayoutOptions(true, caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN, 1)); caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN,
caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN));
uiOrdering.add(&m_intFieldUseFullSpaceLabel,
caf::PdmUiOrdering::LayoutOptions(true, 3, caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN));
uiOrdering.add(&m_intFieldUseFullSpaceField,
caf::PdmUiOrdering::LayoutOptions(true, caf::PdmUiOrdering::LayoutOptions::MAX_COLUMN_SPAN, 1));
uiOrdering.add(&m_intFieldWideLabel, caf::PdmUiOrdering::LayoutOptions(true, 4, 3)); uiOrdering.add(&m_intFieldWideLabel, caf::PdmUiOrdering::LayoutOptions(true, 4, 3));
uiOrdering.add(&m_intFieldWideField, caf::PdmUiOrdering::LayoutOptions(true, 4, 1)); uiOrdering.add(&m_intFieldWideField, caf::PdmUiOrdering::LayoutOptions(true, 4, 1));
uiOrdering.add(&m_intFieldLeft, caf::PdmUiOrdering::LayoutOptions(true)); uiOrdering.add(&m_intFieldLeft, caf::PdmUiOrdering::LayoutOptions(true));
@ -346,7 +552,8 @@ protected:
group->add(&m_intFieldLabelTop, caf::PdmUiOrdering::LayoutOptions(true, 6)); group->add(&m_intFieldLabelTop, caf::PdmUiOrdering::LayoutOptions(true, 6));
group->add(&m_stringFieldLabelHidden, caf::PdmUiOrdering::LayoutOptions(true, 6)); group->add(&m_stringFieldLabelHidden, caf::PdmUiOrdering::LayoutOptions(true, 6));
caf::PdmUiGroup* autoGroup = uiOrdering.addNewGroup("Automatic Full Width Group", caf::PdmUiOrdering::LayoutOptions(true)); caf::PdmUiGroup* autoGroup =
uiOrdering.addNewGroup("Automatic Full Width Group", caf::PdmUiOrdering::LayoutOptions(true));
autoGroup->add(&m_intFieldWideBothAuto, caf::PdmUiOrdering::LayoutOptions(true)); autoGroup->add(&m_intFieldWideBothAuto, caf::PdmUiOrdering::LayoutOptions(true));
autoGroup->add(&m_intFieldLeftAuto, caf::PdmUiOrdering::LayoutOptions(true)); autoGroup->add(&m_intFieldLeftAuto, caf::PdmUiOrdering::LayoutOptions(true));
autoGroup->add(&m_intFieldCenterAuto, false); autoGroup->add(&m_intFieldCenterAuto, false);
@ -354,7 +561,6 @@ protected:
autoGroup->add(&m_intFieldLabelTopAuto, true); autoGroup->add(&m_intFieldLabelTopAuto, true);
autoGroup->add(&m_stringFieldLabelHiddenAuto, true); autoGroup->add(&m_stringFieldLabelHiddenAuto, true);
uiOrdering.add(&m_intFieldLeftOfGroup); uiOrdering.add(&m_intFieldLeftOfGroup);
caf::PdmUiGroup* group2 = uiOrdering.addNewGroup("Right Group", caf::PdmUiOrdering::LayoutOptions(false, 2, 0)); caf::PdmUiGroup* group2 = uiOrdering.addNewGroup("Right Group", caf::PdmUiOrdering::LayoutOptions(false, 2, 0));
group2->setEnableFrame(false); group2->setEnableFrame(false);
@ -371,7 +577,6 @@ protected:
groupR->setEnableFrame(false); groupR->setEnableFrame(false);
groupR->add(&m_intFieldInsideGroup4); groupR->add(&m_intFieldInsideGroup4);
groupR->add(&m_intFieldInsideGroup6); groupR->add(&m_intFieldInsideGroup6);
} }
}; };
@ -396,7 +601,6 @@ public:
"", "",
"Enter some small number here", "Enter some small number here",
"This is a place you can enter a small integer value if you want"); "This is a place you can enter a small integer value if you want");
} }
// Outside group // Outside group
@ -417,22 +621,38 @@ CAF_PDM_SOURCE_INIT(SingleEditorPdmObject, "SingleEditorObject");
class SmallDemoPdmObjectA : public caf::PdmObject class SmallDemoPdmObjectA : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public:
public:
enum TestEnumType enum TestEnumType
{ {
T1, T2, T3 T1,
T2,
T3
}; };
SmallDemoPdmObjectA() SmallDemoPdmObjectA()
{ {
CAF_PDM_InitObject("Small Demo Object A", "", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework"); CAF_PDM_InitObject("Small Demo Object A",
"",
"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, "Toggle Field", "", "Toggle Field tooltip", " Toggle Field whatsthis"); CAF_PDM_InitField(&m_toggleField, "Toggle", false, "Toggle Field", "", "Toggle Field tooltip", " Toggle Field whatsthis");
CAF_PDM_InitField(&m_pushButtonField, "Push", false, "Button Field", "", "", " "); CAF_PDM_InitField(&m_pushButtonField, "Push", false, "Button Field", "", "", " ");
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_doubleField,
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"); "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("Small Demo Object A"), "Name Text Field", "", "", ""); CAF_PDM_InitField(&m_textField, "TextField", QString("Small Demo Object A"), "Name Text Field", "", "", "");
CAF_PDM_InitField(&m_testEnumField, "TestEnumValue", caf::AppEnum<TestEnumType>(T1), "EnumField", "", "", ""); CAF_PDM_InitField(&m_testEnumField, "TestEnumValue", caf::AppEnum<TestEnumType>(T1), "EnumField", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_ptrField, "m_ptrField", "PtrField", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_ptrField, "m_ptrField", "PtrField", "", "", "");
@ -445,7 +665,8 @@ public:
m_testEnumField.capability<caf::PdmUiFieldHandle>()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_testEnumField.capability<caf::PdmUiFieldHandle>()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_multipleAppEnum, "MultipleAppEnumValue", "MultipleAppEnumValue", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_multipleAppEnum, "MultipleAppEnumValue", "MultipleAppEnumValue", "", "", "");
m_multipleAppEnum.capability<caf::PdmUiFieldHandle>()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); m_multipleAppEnum.capability<caf::PdmUiFieldHandle>()->setUiEditorTypeName(
caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_highlightedEnum, "HighlightedEnum", "HighlightedEnum", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_highlightedEnum, "HighlightedEnum", "HighlightedEnum", "", "", "");
m_highlightedEnum.uiCapability()->setUiHidden(true); m_highlightedEnum.uiCapability()->setUiHidden(true);
} }
@ -457,11 +678,16 @@ public:
caf::PdmPtrField<SmallDemoPdmObjectA*> m_ptrField; caf::PdmPtrField<SmallDemoPdmObjectA*> m_ptrField;
caf::PdmProxyValueField<caf::AppEnum<TestEnumType>> m_proxyEnumField; caf::PdmProxyValueField<caf::AppEnum<TestEnumType>> m_proxyEnumField;
void setEnumMember(const caf::AppEnum<TestEnumType>& val) { m_proxyEnumMember = val; } void setEnumMember(const caf::AppEnum<TestEnumType>& val)
caf::AppEnum<TestEnumType> enumMember() const { return m_proxyEnumMember; } {
m_proxyEnumMember = val;
}
caf::AppEnum<TestEnumType> enumMember() const
{
return m_proxyEnumMember;
}
TestEnumType m_proxyEnumMember; TestEnumType m_proxyEnumMember;
// vector of app enum // vector of app enum
caf::PdmField<std::vector<caf::AppEnum<TestEnumType>>> m_multipleAppEnum; caf::PdmField<std::vector<caf::AppEnum<TestEnumType>>> m_multipleAppEnum;
caf::PdmField<caf::AppEnum<TestEnumType>> m_highlightedEnum; caf::PdmField<caf::AppEnum<TestEnumType>> m_highlightedEnum;
@ -490,7 +716,8 @@ public:
} }
} }
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
@ -518,7 +745,9 @@ public:
} }
} }
options.push_back(caf::PdmOptionItemInfo(uiObject->uiName() + "(" + userDesc + ")", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(objects[i])))); options.push_back(
caf::PdmOptionItemInfo(uiObject->uiName() + "(" + userDesc + ")",
QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(objects[i]))));
} }
} }
} }
@ -526,7 +755,8 @@ public:
{ {
for (size_t i = 0; i < caf::AppEnum<TestEnumType>::size(); ++i) for (size_t i = 0; i < caf::AppEnum<TestEnumType>::size(); ++i)
{ {
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<TestEnumType>::uiTextFromIndex(i), caf::AppEnum<TestEnumType>::fromIndex(i))); options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<TestEnumType>::uiTextFromIndex(i),
caf::AppEnum<TestEnumType>::fromIndex(i)));
} }
} }
@ -547,7 +777,9 @@ protected:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override void defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute) override
{ {
if (field == &m_multipleAppEnum) if (field == &m_multipleAppEnum)
{ {
@ -567,13 +799,13 @@ protected:
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override void defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override
{ {
caf::PdmUiTableViewPushButtonEditorAttribute* attr = dynamic_cast<caf::PdmUiTableViewPushButtonEditorAttribute*>(attribute); caf::PdmUiTableViewPushButtonEditorAttribute* attr =
dynamic_cast<caf::PdmUiTableViewPushButtonEditorAttribute*>(attribute);
if (attr) if (attr)
{ {
attr->registerPushButtonTextForFieldKeyword(m_pushButtonField.keyword(), "Edit"); attr->registerPushButtonTextForFieldKeyword(m_pushButtonField.keyword(), "Edit");
@ -592,37 +824,59 @@ namespace caf
addItem(SmallDemoPdmObjectA::T2, "T2", "A B letter"); addItem(SmallDemoPdmObjectA::T2, "T2", "A B letter");
addItem(SmallDemoPdmObjectA::T3, "T3", "A B C letter"); addItem(SmallDemoPdmObjectA::T3, "T3", "A B C letter");
setDefault(SmallDemoPdmObjectA::T1); setDefault(SmallDemoPdmObjectA::T1);
} }
} } // namespace caf
Q_DECLARE_METATYPE(caf::AppEnum<SmallDemoPdmObjectA::TestEnumType>); Q_DECLARE_METATYPE(caf::AppEnum<SmallDemoPdmObjectA::TestEnumType>);
class DemoPdmObject : public caf::PdmObject class DemoPdmObject : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public:
public:
DemoPdmObject() DemoPdmObject()
{ {
CAF_PDM_InitObject( "Demo Object", "", "This object is a demo of the CAF framework", "This object is a demo of the CAF framework"); CAF_PDM_InitObject(
"Demo Object", "", "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, "Toggle Field", "", "Toggle Field tooltip", " Toggle Field whatsthis"); CAF_PDM_InitField(&m_toggleField, "Toggle", false, "Toggle Field", "", "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_doubleField,
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" ); "BigNumber",
CAF_PDM_InitField(&m_boolField, "BooleanValue", false, "Boolean:" , "", "Boolean:Enter some small number here", "Boolean:This is a place you can enter a small integer value if you want"); 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_boolField,
"BooleanValue",
false,
"Boolean:",
"",
"Boolean:Enter some small number here",
"Boolean:This is a place you can enter a small integer value if you want");
CAF_PDM_InitField(&m_textField, "TextField", QString("Demo Object Description Field"), "Description Field", "", "", ""); CAF_PDM_InitField(&m_textField, "TextField", QString("Demo Object Description Field"), "Description Field", "", "", "");
CAF_PDM_InitField(&m_filePath, "FilePath", QString(""), "Filename", "", "", ""); CAF_PDM_InitField(&m_filePath, "FilePath", QString(""), "Filename", "", "", "");
CAF_PDM_InitField(&m_longText, "LongText", QString("Test text"), "Long Text", "", "", ""); CAF_PDM_InitField(&m_longText, "LongText", QString("Test text"), "Long Text", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_multiSelectList, "MultiSelect", "Selection List", "", "List" , "This is a multi selection list" ); CAF_PDM_InitFieldNoDefault(
&m_multiSelectList, "MultiSelect", "Selection List", "", "List", "This is a multi selection list");
CAF_PDM_InitFieldNoDefault(&m_objectList, "ObjectList", "Objects list Field", "", "List", "This is a list of PdmObjects"); CAF_PDM_InitFieldNoDefault(&m_objectList, "ObjectList", "Objects list Field", "", "List", "This is a list of PdmObjects");
CAF_PDM_InitFieldNoDefault(&m_objectListOfSameType, "m_objectListOfSameType", "Same type Objects list Field", "", "Same type List" , "Same type list of PdmObjects" ); CAF_PDM_InitFieldNoDefault(&m_objectListOfSameType,
"m_objectListOfSameType",
"Same type Objects list Field",
"",
"Same type List",
"Same type list of PdmObjects");
m_objectListOfSameType.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName()); m_objectListOfSameType.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName());
m_objectListOfSameType.uiCapability()->setCustomContextMenuEnabled(true);; m_objectListOfSameType.uiCapability()->setCustomContextMenuEnabled(true);
;
CAF_PDM_InitFieldNoDefault(&m_ptrField, "m_ptrField", "PtrField", "", "Same type List", "Same type list of PdmObjects"); CAF_PDM_InitFieldNoDefault(&m_ptrField, "m_ptrField", "PtrField", "", "Same type List", "Same type list of PdmObjects");
m_filePath.capability<caf::PdmUiFieldHandle>()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); m_filePath.capability<caf::PdmUiFieldHandle>()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
@ -654,19 +908,18 @@ public:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
if (&m_multiSelectList == fieldNeedingOptions) if (&m_multiSelectList == fieldNeedingOptions)
{ {
options.push_back(caf::PdmOptionItemInfo("Choice 1", "Choice1")); options.push_back(caf::PdmOptionItemInfo("Choice 1", "Choice1"));
options.push_back(caf::PdmOptionItemInfo("Choice 2", "Choice2")); options.push_back(caf::PdmOptionItemInfo("Choice 2", "Choice2"));
options.push_back(caf::PdmOptionItemInfo("Choice 3", "Choice3")); options.push_back(caf::PdmOptionItemInfo("Choice 3", "Choice3"));
options.push_back(caf::PdmOptionItemInfo("Choice 4", "Choice4")); options.push_back(caf::PdmOptionItemInfo("Choice 4", "Choice4"));
options.push_back(caf::PdmOptionItemInfo("Choice 5", "Choice5")); options.push_back(caf::PdmOptionItemInfo("Choice 5", "Choice5"));
options.push_back(caf::PdmOptionItemInfo("Choice 6", "Choice6")); options.push_back(caf::PdmOptionItemInfo("Choice 6", "Choice6"));
} }
if (&m_ptrField == fieldNeedingOptions) if (&m_ptrField == fieldNeedingOptions)
@ -676,7 +929,9 @@ public:
caf::PdmUiObjectHandle* uiObject = caf::uiObj(m_objectListOfSameType[i]); caf::PdmUiObjectHandle* uiObject = caf::uiObj(m_objectListOfSameType[i]);
if (uiObject) if (uiObject)
{ {
options.push_back(caf::PdmOptionItemInfo(uiObject->uiName(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(m_objectListOfSameType[i])))); options.push_back(caf::PdmOptionItemInfo(
uiObject->uiName(),
QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(m_objectListOfSameType[i]))));
} }
} }
} }
@ -694,8 +949,6 @@ public:
return &m_textField; return &m_textField;
} }
// Fields // Fields
caf::PdmField<bool> m_boolField; caf::PdmField<bool> m_boolField;
caf::PdmField<double> m_doubleField; caf::PdmField<double> m_doubleField;
@ -707,12 +960,10 @@ public:
caf::PdmField<QString> m_longText; caf::PdmField<QString> m_longText;
caf::PdmField<std::vector<QString>> m_multiSelectList; caf::PdmField<std::vector<QString>> m_multiSelectList;
caf::PdmChildArrayField<caf::PdmObjectHandle*> m_objectList; caf::PdmChildArrayField<caf::PdmObjectHandle*> m_objectList;
caf::PdmChildArrayField<SmallDemoPdmObjectA*> m_objectListOfSameType; caf::PdmChildArrayField<SmallDemoPdmObjectA*> m_objectListOfSameType;
caf::PdmPtrField<SmallDemoPdmObjectA*> m_ptrField; caf::PdmPtrField<SmallDemoPdmObjectA*> m_ptrField;
caf::PdmField<bool> m_toggleField; caf::PdmField<bool> m_toggleField;
MenuItemProducer* m_menuItemProducer; MenuItemProducer* m_menuItemProducer;
@ -730,7 +981,6 @@ public:
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -754,6 +1004,7 @@ public:
} }
} }
} }
protected: protected:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -765,13 +1016,10 @@ protected:
caf::PdmUiTableView::addActionsToMenu(menu, &m_objectListOfSameType); caf::PdmUiTableView::addActionsToMenu(menu, &m_objectListOfSameType);
} }
} }
}; };
CAF_PDM_SOURCE_INIT(DemoPdmObject, "DemoPdmObject"); CAF_PDM_SOURCE_INIT(DemoPdmObject, "DemoPdmObject");
MainWindow* MainWindow::sm_mainWindowInstance = nullptr; MainWindow* MainWindow::sm_mainWindowInstance = nullptr;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -807,7 +1055,6 @@ MainWindow::MainWindow()
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem(true); caf::CmdExecCommandManager::instance()->enableUndoCommandSystem(true);
undoView->setStack(caf::CmdExecCommandManager::instance()->undoStack()); undoView->setStack(caf::CmdExecCommandManager::instance()->undoStack());
#endif #endif
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -846,7 +1093,6 @@ void MainWindow::createDockPanels()
addDockWidget(Qt::RightDockWidgetArea, dockWidget); addDockWidget(Qt::RightDockWidgetArea, dockWidget);
} }
{ {
QDockWidget* dockWidget = new QDockWidget("cafPropertyView", this); QDockWidget* dockWidget = new QDockWidget("cafPropertyView", this);
dockWidget->setObjectName("dockWidget"); dockWidget->setObjectName("dockWidget");
@ -883,7 +1129,6 @@ void MainWindow::createDockPanels()
addDockWidget(Qt::RightDockWidgetArea, dockWidget); addDockWidget(Qt::RightDockWidgetArea, dockWidget);
} }
{ {
QDockWidget* dockWidget = new QDockWidget("Undo stack", this); QDockWidget* dockWidget = new QDockWidget("Undo stack", this);
dockWidget->setObjectName("dockWidget"); dockWidget->setObjectName("dockWidget");
@ -894,7 +1139,6 @@ void MainWindow::createDockPanels()
addDockWidget(Qt::RightDockWidgetArea, dockWidget); addDockWidget(Qt::RightDockWidgetArea, dockWidget);
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -936,7 +1180,6 @@ void MainWindow::buildTestModel()
demoObject->m_objectListOfSameType.push_back(new SmallDemoPdmObjectA()); demoObject->m_objectListOfSameType.push_back(new SmallDemoPdmObjectA());
demoObject->m_objectListOfSameType.push_back(new SmallDemoPdmObjectA()); demoObject->m_objectListOfSameType.push_back(new SmallDemoPdmObjectA());
demoObj2->m_objectList.push_back(new SmallDemoPdmObjectA()); demoObj2->m_objectList.push_back(new SmallDemoPdmObjectA());
demoObj2->m_objectList.push_back(new SmallDemoPdmObjectA()); demoObj2->m_objectList.push_back(new SmallDemoPdmObjectA());
demoObj2->m_objectList.push_back(new SmallDemoPdmObject()); demoObj2->m_objectList.push_back(new SmallDemoPdmObject());
@ -944,7 +1187,6 @@ void MainWindow::buildTestModel()
delete smallObj3; delete smallObj3;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1005,7 +1247,6 @@ void MainWindow::setPdmRoot(caf::PdmObjectHandle* pdmRoot)
m_customObjectEditor->setPdmObject(nullptr); m_customObjectEditor->setPdmObject(nullptr);
} }
m_customObjectEditor->updateUi(); m_customObjectEditor->updateUi();
} }
@ -1148,10 +1389,7 @@ void MainWindow::slotRemove()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void MainWindow::slotRemoveAll() void MainWindow::slotRemoveAll() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -1211,14 +1449,13 @@ void MainWindow::slotShowTableView()
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void MainWindow::slotLoadProject() void MainWindow::slotLoadProject()
{ {
QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open Project File"), "test.proj", "Project Files (*.proj);;All files(*.*)"); QString fileName =
QFileDialog::getOpenFileName(nullptr, tr("Open Project File"), "test.proj", "Project Files (*.proj);;All files(*.*)");
if (!fileName.isEmpty()) if (!fileName.isEmpty())
{ {
setPdmRoot(nullptr); setPdmRoot(nullptr);
@ -1237,7 +1474,8 @@ void MainWindow::slotLoadProject()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void MainWindow::slotSaveProject() void MainWindow::slotSaveProject()
{ {
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save Project File"), "test.proj", "Project Files (*.proj);;All files(*.*)"); QString fileName =
QFileDialog::getSaveFileName(nullptr, tr("Save Project File"), "test.proj", "Project Files (*.proj);;All files(*.*)");
if (!fileName.isEmpty()) if (!fileName.isEmpty())
{ {
m_testRoot->fileName = fileName; m_testRoot->fileName = fileName;
@ -1270,5 +1508,4 @@ void MainWindow::slotCustomMenuRequestedForProjectTree(const QPoint&)
menu.exec(QCursor::pos()); menu.exec(QCursor::pos());
caf::CmdFeatureManager::instance()->setCurrentContextMenuTargetWidget(nullptr); caf::CmdFeatureManager::instance()->setCurrentContextMenuTargetWidget(nullptr);
} }
} }

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <QMainWindow>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QItemSelection> #include <QItemSelection>
#include <QMainWindow>
class DemoPdmObject; class DemoPdmObject;
class DemoPdmObjectGroup; class DemoPdmObjectGroup;
@ -19,7 +19,7 @@ namespace caf
class PdmUiTreeView; class PdmUiTreeView;
class PdmUiTableView; class PdmUiTableView;
class CustomObjectEditor; class CustomObjectEditor;
} } // namespace caf
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
@ -69,4 +69,3 @@ private:
QLabel* m_plotLabel; QLabel* m_plotLabel;
QLabel* m_smallPlotLabel; QLabel* m_smallPlotLabel;
}; };

View File

@ -1,15 +1,14 @@
#pragma once #pragma once
#include "cafPdmObject.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h" #include "cafPdmProxyValueField.h"
class ManyGroups : public caf::PdmObject class ManyGroups : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public:
public:
ManyGroups(); ManyGroups();
caf::PdmField<double> m_doubleField; caf::PdmField<double> m_doubleField;
@ -25,14 +24,22 @@ public:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void setDoubleMember(const double& d) { m_doubleMember = d; std::cout << "setDoubleMember" << std::endl; } void setDoubleMember(const double& d)
double doubleMember() const { std::cout << "doubleMember" << std::endl; return m_doubleMember; } {
m_doubleMember = d;
std::cout << "setDoubleMember" << std::endl;
}
double doubleMember() const
{
std::cout << "doubleMember" << std::endl;
return m_doubleMember;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override;
private: private:
double m_doubleMember; double m_doubleMember;
@ -43,7 +50,7 @@ protected:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute) override;
}; };

View File

@ -43,14 +43,10 @@
#include <QTextCursor> #include <QTextCursor>
#include <QTextEdit> #include <QTextEdit>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
MenuItemProducer::MenuItemProducer() MenuItemProducer::MenuItemProducer() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -36,7 +36,6 @@
#pragma once #pragma once
#include <QObject> #include <QObject>
#include <QPoint> #include <QPoint>
#include <QPointer> #include <QPointer>
@ -65,6 +64,3 @@ private:
QPointer<QTextEdit> m_textEdit; QPointer<QTextEdit> m_textEdit;
int m_textPosition; int m_textPosition;
}; };

View File

@ -2,13 +2,10 @@
#include "WidgetLayoutTest.h" #include "WidgetLayoutTest.h"
#include <QGridLayout> #include <QGridLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QGroupBox> #include <QGroupBox>
#include <QLabel> #include <QLabel>
#include <QLineEdit>
#include <QPushButton>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -61,10 +58,7 @@ WidgetLayoutTest::WidgetLayoutTest(QWidget* parent /*= 0*/, Qt::WindowFlags f /*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
WidgetLayoutTest::~WidgetLayoutTest() WidgetLayoutTest::~WidgetLayoutTest() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -2,12 +2,9 @@
#include <QWidget> #include <QWidget>
class QGridLayout; class QGridLayout;
class QGroupBox; class QGroupBox;
class WidgetLayoutTest : public QWidget class WidgetLayoutTest : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -36,6 +33,4 @@ private slots:
void setUpInitialConfigurationA(); void setUpInitialConfigurationA();
void setUpInitialConfigurationB(); void setUpInitialConfigurationB();
}; };

View File

@ -25,12 +25,11 @@
#ifdef TAP_USE_COMMAND_FRAMEWORK #ifdef TAP_USE_COMMAND_FRAMEWORK
#include "cafCmdExecCommandManager.h" #include "cafCmdExecCommandManager.h"
#include "cafCmdSelectionHelper.h"
#include "cafCmdFeatureManager.h" #include "cafCmdFeatureManager.h"
#include "cafCmdSelectionHelper.h"
#endif #endif
#include "TapProject.h" #include "TapProject.h"
MainWindow* MainWindow::sm_mainWindowInstance = NULL; MainWindow* MainWindow::sm_mainWindowInstance = NULL;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -55,7 +54,6 @@ MainWindow::MainWindow()
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem(true); caf::CmdExecCommandManager::instance()->enableUndoCommandSystem(true);
undoView->setStack(caf::CmdExecCommandManager::instance()->undoStack()); undoView->setStack(caf::CmdExecCommandManager::instance()->undoStack());
#endif #endif
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -112,7 +110,6 @@ void MainWindow::createDockPanels()
addDockWidget(Qt::RightDockWidgetArea, dockWidget); addDockWidget(Qt::RightDockWidgetArea, dockWidget);
} }
{ {
QDockWidget* dockWidget = new QDockWidget("Undo stack", this); QDockWidget* dockWidget = new QDockWidget("Undo stack", this);
dockWidget->setObjectName("dockWidget"); dockWidget->setObjectName("dockWidget");
@ -123,7 +120,6 @@ void MainWindow::createDockPanels()
addDockWidget(Qt::RightDockWidgetArea, dockWidget); addDockWidget(Qt::RightDockWidgetArea, dockWidget);
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -134,7 +130,6 @@ void MainWindow::buildTestModel()
m_project = new TapProject; m_project = new TapProject;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -216,7 +211,6 @@ void MainWindow::createActions()
connect(editRemove, SIGNAL(triggered()), SLOT(slotRemove())); connect(editRemove, SIGNAL(triggered()), SLOT(slotRemove()));
connect(editRemoveAll, SIGNAL(triggered()), SLOT(slotRemoveAll())); connect(editRemoveAll, SIGNAL(triggered()), SLOT(slotRemoveAll()));
// Create menus // Create menus
QMenu* editMenu = menuBar()->addMenu("&Edit"); QMenu* editMenu = menuBar()->addMenu("&Edit");
editMenu->addAction(editInsert); editMenu->addAction(editInsert);
@ -295,10 +289,7 @@ void MainWindow::slotRemove()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void MainWindow::slotRemoveAll() void MainWindow::slotRemoveAll() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -1,15 +1,14 @@
#pragma once #pragma once
#include <QMainWindow>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QItemSelection> #include <QItemSelection>
#include <QMainWindow>
class QTreeView; class QTreeView;
class QUndoView; class QUndoView;
class TapProject; class TapProject;
namespace caf namespace caf
{ {
class PdmObjectCollection; class PdmObjectCollection;
@ -18,7 +17,7 @@ namespace caf
class PdmUiPropertyView; class PdmUiPropertyView;
class PdmUiTreeView; class PdmUiTreeView;
class PdmUiTableView; class PdmUiTableView;
} } // namespace caf
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
@ -37,7 +36,6 @@ private:
void createToolBars(); void createToolBars();
void createDockPanels(); void createDockPanels();
void buildTestModel(); void buildTestModel();
void releaseTestData(); void releaseTestData();
@ -49,7 +47,6 @@ private slots:
void slotSimpleSelectionChanged(); void slotSimpleSelectionChanged();
void slotShowTableView(); void slotShowTableView();
private: private:
static MainWindow* sm_mainWindowInstance; static MainWindow* sm_mainWindowInstance;
@ -63,4 +60,3 @@ private:
TapProject* m_project; TapProject* m_project;
}; };

View File

@ -2,11 +2,8 @@
#include "cafPdmUiListEditor.h" #include "cafPdmUiListEditor.h"
CAF_PDM_SOURCE_INIT(TapCvfSpecialization, "TapCvfSpecialization"); CAF_PDM_SOURCE_INIT(TapCvfSpecialization, "TapCvfSpecialization");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -26,7 +23,9 @@ TapCvfSpecialization::TapCvfSpecialization()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void TapCvfSpecialization::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void TapCvfSpecialization::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{ {
if (changedField == &m_colorField) if (changedField == &m_colorField)
{ {
@ -37,7 +36,9 @@ void TapCvfSpecialization::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void TapCvfSpecialization::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) void TapCvfSpecialization::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
{ {
if (field == &m_vecArrayField) if (field == &m_vecArrayField)
{ {
@ -48,4 +49,3 @@ void TapCvfSpecialization::defineEditorAttribute(const caf::PdmFieldHandle* fiel
} }
} }
} }

View File

@ -1,30 +1,26 @@
#pragma once #pragma once
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfColor3.h" #include "cvfColor3.h"
#include "cvfVector3.h"
#include "cvfMatrix4.h" #include "cvfMatrix4.h"
#include "cvfVector3.h"
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmFieldCvfMat4d.h" #include "cafPdmFieldCvfMat4d.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmObject.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h"
#include <vector> #include <vector>
class TapCvfSpecialization : public caf::PdmObject class TapCvfSpecialization : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
TapCvfSpecialization(); TapCvfSpecialization();
caf::PdmField<QString> m_testField; caf::PdmField<QString> m_testField;
caf::PdmField<cvf::Color3f> m_colorField; caf::PdmField<cvf::Color3f> m_colorField;
@ -37,6 +33,6 @@ public:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
protected: protected:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); virtual void
defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
}; };

View File

@ -17,7 +17,4 @@ TapProject::TapProject(void)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
TapProject::~TapProject(void) TapProject::~TapProject(void) {}
{
}

View File

@ -1,13 +1,11 @@
#pragma once #pragma once
#include "cafPdmDocument.h"
#include "cafPdmChildArrayField.h" #include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h" #include "cafPdmChildField.h"
#include "cafPdmDocument.h"
class TapCvfSpecialization; class TapCvfSpecialization;
class TapProject : public caf::PdmDocument class TapProject : public caf::PdmDocument
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;

View File

@ -2,13 +2,10 @@
#include "WidgetLayoutTest.h" #include "WidgetLayoutTest.h"
#include <QGridLayout> #include <QGridLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QGroupBox> #include <QGroupBox>
#include <QLabel> #include <QLabel>
#include <QLineEdit>
#include <QPushButton>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -61,10 +58,7 @@ WidgetLayoutTest::WidgetLayoutTest(QWidget* parent /*= 0*/, Qt::WindowFlags f /*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
WidgetLayoutTest::~WidgetLayoutTest() WidgetLayoutTest::~WidgetLayoutTest() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -2,12 +2,9 @@
#include <QWidget> #include <QWidget>
class QGridLayout; class QGridLayout;
class QGroupBox; class QGroupBox;
class WidgetLayoutTest : public QWidget class WidgetLayoutTest : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -36,6 +33,4 @@ private slots:
void setUpInitialConfigurationA(); void setUpInitialConfigurationA();
void setUpInitialConfigurationB(); void setUpInitialConfigurationB();
}; };