Tree item containing simple property. More...
#include <treeitemsimple.h>
Public Member Functions | |
| TreeItemSimple (TreeData *_data, Q_ListView *parent, boost::shared_ptr< IProperty > pdfObj, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL) | |
| TreeItemSimple (TreeData *_data, Q_ListViewItem *parent, boost::shared_ptr< IProperty > pdfObj, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL) | |
| virtual | ~TreeItemSimple () |
| virtual bool | setObject (boost::shared_ptr< IProperty > newItem) |
| virtual bool | validChild (const QString &name, Q_ListViewItem *oldChild) |
| virtual ChildType | getChildType (const QString &name) |
| virtual TreeItemAbstract * | createChild (const QString &name, ChildType typ, Q_ListViewItem *after=NULL) |
| virtual QStringList | getChildNames () |
| virtual bool | haveChild () |
Tree item containing simple property.
Class holding one simple object in tree (not reference, dict or array)
Simple types are: int, real, string, name, bool or null
| gui::TreeItemSimple::TreeItemSimple | ( | TreeData * | _data, | |
| Q_ListView * | parent, | |||
| boost::shared_ptr< IProperty > | pdfObj, | |||
| const QString | name = QString::null, |
|||
| Q_ListViewItem * | after = NULL, |
|||
| const QString & | nameId = NULL | |||
| ) |
constructor of TreeItem - create root item from given object
| parent | Q_ListView in which to put item | |
| pdfObj | Object contained in this item | |
| nameId | Internal name of this item | |
| name | Caption of this item - will be shown in treeview | |
| _data | TreeData containing necessary information about tree in which this item will be inserted | |
| after | Item after which this one will be inserted |
References gui::TreeItemAbstract::data, and gui::TreeItemAbstract::reload().
| gui::TreeItemSimple::TreeItemSimple | ( | TreeData * | _data, | |
| Q_ListViewItem * | parent, | |||
| boost::shared_ptr< IProperty > | pdfObj, | |||
| const QString | name = QString::null, |
|||
| Q_ListViewItem * | after = NULL, |
|||
| const QString & | nameId = NULL | |||
| ) |
constructor of TreeItem - create child item from given object
| parent | Q_ListViewItem which is parent of this object | |
| pdfObj | Object contained in this item | |
| nameId | Internal name of this item | |
| name | Caption of this item - will be shown in treeview | |
| _data | TreeData containing necessary information about tree in which this item will be inserted | |
| after | Item after which this one will be inserted |
References gui::TreeItemAbstract::data, and gui::TreeItemAbstract::reload().
| gui::TreeItemSimple::~TreeItemSimple | ( | ) | [virtual] |
default destructor
| TreeItemAbstract * gui::TreeItemSimple::createChild | ( | const QString & | name, | |
| ChildType | typ, | |||
| Q_ListViewItem * | after = NULL | |||
| ) | [virtual] |
Create one subchild
| name | Name of child (the same as in list returned from getChildNames) | |
| typ | Type of TreeItemAbstract's child. (see ChildType) | |
| after | Q_ListViewItem after which will be this item added. If unspecified (or NULL), it is added before any other items |
Implements gui::TreeItemAbstract.
References pdfobjects::pArray, pdfobjects::pDict, and pdfobjects::pRef.
| QStringList gui::TreeItemSimple::getChildNames | ( | ) | [virtual] |
Get list of all item's childs names
Implements gui::TreeItemAbstract.
References pdfobjects::pArray, pdfobjects::pDict, and pdfobjects::pRef.
| ChildType gui::TreeItemSimple::getChildType | ( | const QString & | name | ) | [virtual] |
Get type of this items child, given its name.
| name | Name of child item |
Implements gui::TreeItemAbstract.
References pdfobjects::pArray, pdfobjects::pDict, and pdfobjects::pRef.
| bool gui::TreeItemSimple::haveChild | ( | ) | [virtual] |
Return true, if the item have at least one child
Implements gui::TreeItemAbstract.
| bool gui::TreeItemSimple::setObject | ( | boost::shared_ptr< IProperty > | newItem | ) | [virtual] |
This method is needed for "deep reload" to work Try to replace object inside this treeitem with a new one.
| newItem | new object to replace the old one |
Reimplemented from gui::TreeItem.
References util::getTypeName(), gui::TreeItem::haveObserver(), gui::TreeItem::initObserver(), gui::TreeItem::obj, and gui::TreeItem::uninitObserver().
| bool gui::TreeItemSimple::validChild | ( | const QString & | name, | |
| Q_ListViewItem * | oldChild | |||
| ) | [virtual] |
Validate child, given its name and reference to old child Usually it is valid, since item with same name refer to same subitem (key-based items), but for value-based items (array) same keys can correspond to different values after reloading. In such cases, false should be returned. Also, similar problems can happen when switching revisions (with almost all types)
Note: false negative it not a problem (only unnecessary reloading), while false positive mean the tree is invalid/outdated
| name | name of (old and new) treeitem | |
| oldChild | reference to old child tree item |
Implements gui::TreeItemAbstract.