The link between the tree and a document. More...

#include <Tree.h>

Classes

class  ExpandInfo
 

Public Types

typedef std::shared_ptr< ExpandInfoExpandInfoPtr
 
enum  SelectionReason { SR_SELECT , SR_EXPAND , SR_FORCE_EXPAND }
 

Public Member Functions

void clearSelection (DocumentObjectItem *exclude=0)
 
Gui::Documentdocument () const
 
 DocumentItem (const Gui::Document *doc, QTreeWidgetItem *parent)
 
virtual unsigned int getMemSize (void) const override
 This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? More...
 
TreeWidgetgetTree () const
 
const char * getTreeName () const
 
ViewProviderDocumentObjectgetViewProvider (App::DocumentObject *)
 
bool isObjectShowable (App::DocumentObject *obj)
 
void populateItem (DocumentObjectItem *item, bool refresh=false, bool delayUpdate=true)
 
bool populateObject (App::DocumentObject *obj)
 
virtual void Restore (Base::XMLReader &) override
 This method is used to restore properties from an XML document. More...
 
virtual void Save (Base::Writer &) const override
 This method is used to save properties to an XML document. More...
 
void selectAllInstances (const ViewProviderDocumentObject &vpd)
 
void selectItems (SelectionReason reason=SR_SELECT)
 
void setData (int column, int role, const QVariant &value) override
 
void setShowHidden (bool show)
 
bool showHidden () const
 
bool showItem (DocumentObjectItem *item, bool select, bool force=false)
 
void testStatus (void)
 
void updateItemSelection (DocumentObjectItem *)
 
void updateItemsVisibility (QTreeWidgetItem *item, bool show)
 
void updateLinks (const ViewProviderDocumentObject &view)
 
void updateSelection ()
 
void updateSelection (QTreeWidgetItem *, bool unselect=false)
 
 ~DocumentItem ()
 
- Public Member Functions inherited from Base::Persistence
void dumpToStream (std::ostream &stream, int compression)
 
virtual Base::Type getTypeId (void) const
 
virtual void RestoreDocFile (Reader &)
 This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data. More...
 
void restoreFromStream (std::istream &stream)
 
virtual void SaveDocFile (Writer &) const
 This method is used to save large amounts of data to a binary file. More...
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction. More...
 
virtual PyObjectgetPyObject (void)
 This method returns the Python wrapper for a C++ object. More...
 
bool isDerivedFrom (const Type type) const
 
virtual void setPyObject (PyObject *)
 
virtual ~BaseClass ()
 Destruction. More...
 

Protected Types

typedef std::unordered_map< const ViewProvider *, std::vector< ViewProviderDocumentObject * > > ViewParentMap
 

Protected Member Functions

bool createNewItem (const Gui::ViewProviderDocumentObject &, QTreeWidgetItem *parent=0, int index=-1, DocumentObjectDataPtr ptrs=DocumentObjectDataPtr())
 
DocumentObjectItemfindItem (bool sync, DocumentObjectItem *item, const char *subname, bool select=true)
 
DocumentObjectItemfindItemByObject (bool sync, App::DocumentObject *obj, const char *subname, bool select=false)
 
int findRootIndex (App::DocumentObject *childObj)
 
App::DocumentObjectgetTopParent (App::DocumentObject *obj, std::string &subname)
 
void populateParents (const ViewProvider *vp, ViewParentMap &)
 
void slotExpandObject (const Gui::ViewProviderDocumentObject &, const Gui::TreeItemMode &, const App::DocumentObject *parent, const char *subname)
 
void slotHighlightObject (const Gui::ViewProviderDocumentObject &, const Gui::HighlightMode &, bool, const App::DocumentObject *parent, const char *subname)
 
void slotInEdit (const Gui::ViewProviderDocumentObject &)
 Removes a view provider from the document item. More...
 
void slotNewObject (const Gui::ViewProviderDocumentObject &)
 Adds a view provider to the document item. More...
 
void slotRecomputed (const App::Document &doc, const std::vector< App::DocumentObject * > &objs)
 
void slotRecomputedObject (const App::DocumentObject &)
 
void slotResetEdit (const Gui::ViewProviderDocumentObject &)
 
void slotScrollToObject (const Gui::ViewProviderDocumentObject &)
 
bool updateObject (const Gui::ViewProviderDocumentObject &, const App::Property &prop)
 

Friends

class DocumentObjectData
 
class DocumentObjectItem
 
class TreeWidget
 

Additional Inherited Members

- Static Public Member Functions inherited from Base::Persistence
static void * create (void)
 
static std::string encodeAttribute (const std::string &)
 Encodes an attribute upon saving. More...
 
static Base::Type getClassTypeId (void)
 
static void init (void)
 
- Static Public Member Functions inherited from Base::BaseClass
static void * create (void)
 
static Type getClassTypeId (void)
 
static void init (void)
 
- Static Protected Member Functions inherited from Base::BaseClass
static void initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr)
 

Detailed Description

The link between the tree and a document.

Every document in the application gets its associated DocumentItem which controls the visibility and the functions of the document.

Author
J├╝rgen Riegel

Member Typedef Documentation

◆ ExpandInfoPtr

typedef std::shared_ptr<ExpandInfo> Gui::DocumentItem::ExpandInfoPtr

◆ ViewParentMap

typedef std::unordered_map<const ViewProvider *, std::vector<ViewProviderDocumentObject*> > Gui::DocumentItem::ViewParentMap
protected

Member Enumeration Documentation

◆ SelectionReason

Enumerator
SR_SELECT 
SR_EXPAND 
SR_FORCE_EXPAND 

Constructor & Destructor Documentation

◆ DocumentItem()

◆ ~DocumentItem()

DocumentItem::~DocumentItem ( )

Member Function Documentation

◆ clearSelection()

void DocumentItem::clearSelection ( DocumentObjectItem exclude = 0)

◆ createNewItem()

◆ document()

Gui::Document * DocumentItem::document ( ) const

Referenced by Gui::TreeWidget::contextMenuEvent(), Gui::TreeWidget::dropEvent(), femtest.app.test_solver_calculix.TestSolverCalculix::input_file_writing_test(), femtest.app.test_solver_elmer.TestSolverElmer::input_file_writing_test(), femtest.app.test_ccxtools.TestCcxTools::input_file_writing_test(), femtest.app.test_solver_z88.TestSolverZ88::inputfile_writing_test(), Gui::TreeWidget::mouseDoubleClickEvent(), Gui::TreeWidget::onAllowPartialRecompute(), Gui::TreeWidget::onCloseDoc(), Gui::TreeWidget::onCreateGroup(), Gui::TreeWidget::onMarkRecompute(), Gui::TreeWidget::onReloadDoc(), Gui::TreeWidget::onSkipRecompute(), Gui::TreeWidget::onStartEditing(), populateItem(), Restore(), Mod.Show.mTempoVis.TempoVis::restoreCamera(), femtest.app.test_ccxtools.TestCcxTools::result_reading_test(), Mod.Show.mTempoVis.TempoVis::saveCamera(), slotExpandObject(), slotHighlightObject(), Gui::TreeWidget::syncView(), femtest.app.test_ccxtools.TestCcxTools::tearDown(), femtest.app.test_common.TestFemCommon::tearDown(), femtest.app.test_femimport.TestObjectExistance::tearDown(), femtest.app.test_material.TestMaterialUnits::tearDown(), femtest.app.test_mesh.TestMeshCommon::tearDown(), femtest.app.test_mesh.TestMeshEleTetra10::tearDown(), femtest.app.test_mesh.TestMeshGroups::tearDown(), femtest.app.test_object.TestObjectCreate::tearDown(), femtest.app.test_object.TestObjectType::tearDown(), femtest.app.test_open.TestObjectOpen::tearDown(), femtest.app.test_result.TestResult::tearDown(), femtest.app.test_solver_calculix.TestSolverCalculix::tearDown(), femtest.app.test_solver_elmer.TestSolverElmer::tearDown(), femtest.app.test_solver_z88.TestSolverZ88::tearDown(), femtest.gui.test_open.TestObjectOpen::tearDown(), femtest.app.test_common.TestFemCommon::test_adding_refshaps(), femtest.app.test_ccxtools.TestCcxTools::test_box_frequency(), femtest.app.test_solver_calculix.TestSolverCalculix::test_box_frequency(), femtest.app.test_ccxtools.TestCcxTools::test_box_static(), femtest.app.test_solver_calculix.TestSolverCalculix::test_box_static(), femtest.app.test_solver_elmer.TestSolverElmer::test_box_static_0_mm(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccxcantilever_faceload(), femtest.app.test_solver_z88.TestSolverZ88::test_ccxcantilever_faceload(), femtest.app.test_solver_elmer.TestSolverElmer::test_ccxcantilever_faceload_0_mm(), femtest.app.test_solver_elmer.TestSolverElmer::test_ccxcantilever_faceload_1_si(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccxcantilever_hexa20(), femtest.app.test_solver_z88.TestSolverZ88::test_ccxcantilever_hexa20(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccxcantilever_nodeload(), femtest.app.test_solver_z88.TestSolverZ88::test_ccxcantilever_nodeload(), femtest.app.test_solver_elmer.TestSolverElmer::test_ccxcantilever_nodeload_0_mm(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccxcantilever_prescribeddisplacement(), femtest.app.test_solver_elmer.TestSolverElmer::test_ccxcantilever_prescribeddisplacement_0_mm(), femtest.app.test_solver_calculix.TestSolverCalculix::test_constraint_contact_shell_shell(), femtest.app.test_solver_calculix.TestSolverCalculix::test_constraint_contact_solid_solid(), femtest.app.test_solver_calculix.TestSolverCalculix::test_constraint_sectionprint(), femtest.app.test_solver_calculix.TestSolverCalculix::test_constraint_selfweight_cantilever(), femtest.app.test_solver_calculix.TestSolverCalculix::test_constraint_tie(), femtest.app.test_object.TestObjectType::test_femobjects_derivedfromfem(), femtest.app.test_object.TestObjectType::test_femobjects_derivedfromstd(), femtest.app.test_object.TestObjectType::test_femobjects_isoftype(), femtest.app.test_object.TestObjectCreate::test_femobjects_make(), femtest.app.test_open.TestObjectOpen::test_femobjects_open_de9b3fb438(), femtest.gui.test_open.TestObjectOpen::test_femobjects_open_de9b3fb438(), femtest.app.test_open.TestObjectOpen::test_femobjects_open_head(), femtest.gui.test_open.TestObjectOpen::test_femobjects_open_head(), femtest.app.test_object.TestObjectType::test_femobjects_type(), femtest.app.test_solver_calculix.TestSolverCalculix::test_material_multiple_bendingbeam_fiveboxes(), femtest.app.test_solver_calculix.TestSolverCalculix::test_material_multiple_bendingbeam_fivefaces(), femtest.app.test_solver_calculix.TestSolverCalculix::test_material_multiple_tensionrod_twoboxes(), femtest.app.test_solver_calculix.TestSolverCalculix::test_material_nonlinear(), femtest.app.test_femimport.TestObjectExistance::test_objects_existance(), femtest.app.test_solver_calculix.TestSolverCalculix::test_square_pipe_end_twisted_edgeforces(), femtest.app.test_solver_calculix.TestSolverCalculix::test_square_pipe_end_twisted_nodeforces(), femtest.app.test_solver_calculix.TestSolverCalculix::test_thermomech_bimetall(), femtest.app.test_ccxtools.TestCcxTools::test_thermomech_flow1D(), femtest.app.test_solver_calculix.TestSolverCalculix::test_thermomech_flow1D(), femtest.app.test_ccxtools.TestCcxTools::test_thermomech_spine(), femtest.app.test_solver_calculix.TestSolverCalculix::test_thermomech_spine(), Gui::DocumentObjectItem::testStatus(), Mod.Show.TVStack.TVStack::unwindForSaving(), Gui::DocumentObjectData::updateChildren(), and femsolver.calculix.writer.FemInputWriterCcx::write_footer().

◆ findItem()

◆ findItemByObject()

DocumentObjectItem * DocumentItem::findItemByObject ( bool  sync,
App::DocumentObject obj,
const char *  subname,
bool  select = false 
)
protected

◆ findRootIndex()

◆ getMemSize()

unsigned int DocumentItem::getMemSize ( void  ) const
overridevirtual

This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?

Implements Base::Persistence.

◆ getTopParent()

App::DocumentObject * DocumentItem::getTopParent ( App::DocumentObject obj,
std::string &  subname 
)
protected

◆ getTree()

◆ getTreeName()

const char * DocumentItem::getTreeName ( ) const

◆ getViewProvider()

◆ isObjectShowable()

bool DocumentItem::isObjectShowable ( App::DocumentObject obj)

◆ populateItem()

◆ populateObject()

bool DocumentItem::populateObject ( App::DocumentObject obj)

References populateItem().

◆ populateParents()

void DocumentItem::populateParents ( const ViewProvider vp,
ViewParentMap parentMap 
)
protected

References populateItem().

Referenced by selectAllInstances().

◆ Restore()

void DocumentItem::Restore ( Base::XMLReader )
overridevirtual

This method is used to restore properties from an XML document.

It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:

void PropertyVector::Restore(Base::XMLReader &reader)
{
// read my Element
reader.readElement("PropertyVector");
// get the value of my Attribute
_cVec.x = reader.getAttributeAsFloat("valueX");
_cVec.y = reader.getAttributeAsFloat("valueY");
_cVec.z = reader.getAttributeAsFloat("valueZ");
}
The XML reader class This is an important helper class for the store and retrieval system of objects ...
Definition: Reader.h:118
void readElement(const char *ElementName=0)
read until a start element is found (<name>) or start-end element (<name/>) (with special name if giv...
Definition: Reader.cpp:240
double getAttributeAsFloat(const char *AttrName) const
return the named attribute as a double floating point (does type checking)
Definition: Reader.cpp:158

Implements Base::Persistence.

References document(), getTree(), Base::XMLReader::hasAttribute(), and Base::XMLReader::readElement().

◆ Save()

void DocumentItem::Save ( Base::Writer ) const
overridevirtual

This method is used to save properties to an XML document.

A good example you'll find in PropertyStandard.cpp, e.g. the vector:

void PropertyVector::Save (Writer &writer) const
{
writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x <<
"\" valueY=\"" << _cVec.y <<
"\" valueZ=\"" << _cVec.z <<"\"/>" << endl;
}

The writer.ind() expression writes the indentation, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.

See also
Base::Writer

Implements Base::Persistence.

References Base::Writer::ind(), and Base::Writer::Stream().

◆ selectAllInstances()

◆ selectItems()

◆ setData()

void DocumentItem::setData ( int  column,
int  role,
const QVariant &  value 
)
override

◆ setShowHidden()

void DocumentItem::setShowHidden ( bool  show)

◆ showHidden()

◆ showItem()

bool DocumentItem::showItem ( DocumentObjectItem item,
bool  select,
bool  force = false 
)

◆ slotExpandObject()

◆ slotHighlightObject()

void DocumentItem::slotHighlightObject ( const Gui::ViewProviderDocumentObject obj,
const Gui::HighlightMode high,
bool  set,
const App::DocumentObject parent,
const char *  subname 
)
protected

◆ slotInEdit()

void DocumentItem::slotInEdit ( const Gui::ViewProviderDocumentObject v)
protected

◆ slotNewObject()

void DocumentItem::slotNewObject ( const Gui::ViewProviderDocumentObject obj)
protected

Adds a view provider to the document item.

If this view provider is already added nothing happens.

References Gui::Document::getDocument(), App::Document::getName(), and getTree().

Referenced by DocumentItem().

◆ slotRecomputed()

void DocumentItem::slotRecomputed ( const App::Document doc,
const std::vector< App::DocumentObject * > &  objs 
)
protected

References getTree().

Referenced by DocumentItem(), and slotRecomputedObject().

◆ slotRecomputedObject()

void DocumentItem::slotRecomputedObject ( const App::DocumentObject obj)
protected

References slotRecomputed().

Referenced by DocumentItem().

◆ slotResetEdit()

void DocumentItem::slotResetEdit ( const Gui::ViewProviderDocumentObject v)
protected

References getTree().

Referenced by DocumentItem().

◆ slotScrollToObject()

void DocumentItem::slotScrollToObject ( const Gui::ViewProviderDocumentObject obj)
protected

References getTree().

Referenced by DocumentItem().

◆ testStatus()

void DocumentItem::testStatus ( void  )

◆ updateItemSelection()

◆ updateItemsVisibility()

void DocumentItem::updateItemsVisibility ( QTreeWidgetItem item,
bool  show 
)

References Gui::TreeWidget::ObjectType.

Referenced by populateItem().

◆ updateLinks()

void Gui::DocumentItem::updateLinks ( const ViewProviderDocumentObject view)

◆ updateObject()

bool Gui::DocumentItem::updateObject ( const Gui::ViewProviderDocumentObject ,
const App::Property prop 
)
protected

◆ updateSelection() [1/2]

◆ updateSelection() [2/2]

Friends And Related Function Documentation

◆ DocumentObjectData

friend class DocumentObjectData
friend

◆ DocumentObjectItem

friend class DocumentObjectItem
friend

Referenced by createNewItem().

◆ TreeWidget

friend class TreeWidget
friend

The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/Gui/Tree.h
  • Sources/FreeCAD/src/Gui/Tree.cpp