Gui::DocumentItem Class Reference

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=nullptr)
 
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 unsigned int getMemSize () const =0
 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...
 
virtual Base::Type getTypeId (void) const
 
virtual void Restore (XMLReader &)=0
 This method is used to restore properties from an XML document. More...
 
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 Save (Writer &) const =0
 This method is used to save properties to an XML document. More...
 
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...
 
 BaseClass (const BaseClass &)=default
 
virtual PyObjectgetPyObject ()
 This method returns the Python wrapper for a C++ object. More...
 
virtual Type getTypeId () const
 
bool isDerivedFrom (const Type type) const
 
BaseClassoperator= (const BaseClass &)=default
 
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=nullptr, 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 ()
 
static Type getClassTypeId ()
 
static void init ()
 
- 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 = nullptr)

◆ 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_solver_mystran.TestSolverMystran::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::onSelectDependents(), 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_mystran.TestSolverMystran::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_ccx_buckling_flexuralbuckling(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_beam_circle(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_beam_pipe(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_beam_rect(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_ele_hexa20(), femtest.app.test_solver_z88.TestSolverZ88::test_ccx_cantilever_ele_hexa20(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_ele_quad4(), femtest.app.test_solver_mystran.TestSolverMystran::test_ccx_cantilever_ele_quad4(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_ele_quad8(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_ele_seg2(), femtest.app.test_solver_mystran.TestSolverMystran::test_ccx_cantilever_ele_seg2(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_ele_seg3(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_ele_tria3(), femtest.app.test_solver_mystran.TestSolverMystran::test_ccx_cantilever_ele_tria3(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_ele_tria6(), femtest.app.test_solver_z88.TestSolverZ88::test_ccx_cantilever_ele_tria6(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_faceload(), femtest.app.test_solver_mystran.TestSolverMystran::test_ccx_cantilever_faceload(), femtest.app.test_solver_z88.TestSolverZ88::test_ccx_cantilever_faceload(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_nodeload(), femtest.app.test_solver_mystran.TestSolverMystran::test_ccx_cantilever_nodeload(), femtest.app.test_solver_z88.TestSolverZ88::test_ccx_cantilever_nodeload(), femtest.app.test_solver_calculix.TestSolverCalculix::test_ccx_cantilever_prescribeddisplacement(), 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_elmer.TestSolverElmer::test_ccxcantilever_nodeload_0_mm(), femtest.app.test_solver_elmer.TestSolverElmer::test_ccxcantilever_prescribeddisplacement_0_mm(), femtest.app.test_solver_calculix.TestSolverCalculix::test_constraint_centrif(), 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_solver_calculix.TestSolverCalculix::test_constraint_transform_beam_hinged(), femtest.app.test_solver_calculix.TestSolverCalculix::test_constraint_transform_torque(), 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_frequency_beamsimple(), 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_solver_mystran.TestSolverMystran::test_mystran_plate(), 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(), and Gui::DocumentObjectData::updateChildren().

◆ 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

◆ 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");
}

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()

◆ 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: