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

#include <Tree.h>


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)


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.

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

Member Enumeration Documentation

◆ SelectionReason


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(),,,,, 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(),, Mod.Show.mTempoVis.TempoVis::saveCamera(), slotExpandObject(), slotHighlightObject(), Gui::TreeWidget::syncView(),,,,,,,,,,,,,,, femtest.gui.test_open.TestObjectOpen::tearDown(),,,,,,,,,,,,,,,,,,,,,,,,,,,, femtest.gui.test_open.TestObjectOpen::test_femobjects_open_de9b3fb438(),, femtest.gui.test_open.TestObjectOpen::test_femobjects_open_head(),,,,,,,,,,,,,, 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 

◆ findRootIndex()

◆ getMemSize()

unsigned int DocumentItem::getMemSize ( void  ) const

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 

◆ 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 

References populateItem().

Referenced by selectAllInstances().

◆ Restore()

void DocumentItem::Restore ( Base::XMLReader )

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
// 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

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

Implements Base::Persistence.

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

◆ selectAllInstances()

◆ selectItems()

◆ setData()

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

◆ 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 

◆ slotInEdit()

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

◆ slotNewObject()

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

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 

References getTree().

Referenced by DocumentItem(), and slotRecomputedObject().

◆ slotRecomputedObject()

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

References slotRecomputed().

Referenced by DocumentItem().

◆ slotResetEdit()

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

References getTree().

Referenced by DocumentItem().

◆ slotScrollToObject()

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

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 

◆ updateSelection() [1/2]

◆ updateSelection() [2/2]

Friends And Related Function Documentation

◆ DocumentObjectData

friend class DocumentObjectData

◆ DocumentObjectItem

friend class DocumentObjectItem

Referenced by createNewItem().

◆ TreeWidget

friend class TreeWidget

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