Tree item containing CDict. More...
#include <treeitemdict.h>
Public Member Functions | |
| void | remove (const QString &name) |
| TreeItemDict (TreeData *_data, Q_ListView *parent, boost::shared_ptr< IProperty > pdfObj, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL) | |
| TreeItemDict (TreeData *_data, Q_ListViewItem *parent, boost::shared_ptr< IProperty > pdfObj, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL) | |
| virtual | ~TreeItemDict () |
| virtual bool | validChild (const QString &name, Q_ListViewItem *oldChild) |
| virtual bool | deepReload (const QString &childName, Q_ListViewItem *oldItem) |
| virtual QSCObject * | getQSObject (BaseCore *_base) |
| virtual ChildType | getChildType (const QString &name) |
| virtual TreeItemAbstract * | createChild (const QString &name, ChildType typ, Q_ListViewItem *after=NULL) |
| virtual QStringList | getChildNames () |
| virtual bool | haveChild () |
| virtual QSCObject * | getQSObject () |
Tree item containing CDict.
class holding one CDict object in tree (dictionary)
| gui::TreeItemDict::TreeItemDict | ( | 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, gui::TreeItem::initObserver(), and gui::TreeItemAbstract::reload().
| gui::TreeItemDict::TreeItemDict | ( | 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, gui::TreeItem::initObserver(), and gui::TreeItemAbstract::reload().
| gui::TreeItemDict::~TreeItemDict | ( | ) | [virtual] |
default destructor
References gui::TreeItem::uninitObserver().
| TreeItemAbstract * gui::TreeItemDict::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 util::convertFromUnicode(), gui::TreeItem::create(), gui::TreeItemAbstract::data, debug::DBG_ERR, pdfobjects::CDict::getProperty(), guiPrintDbg, gui::TreeItem::obj, and util::PDF.
| bool gui::TreeItemDict::deepReload | ( | const QString & | childName, | |
| Q_ListViewItem * | oldItem | |||
| ) | [virtual] |
Attempt to "deep reload", i.e. exchange the item inside the tree for an actual (different) one, without destroying the object (destroying have unfortunate effect of losing information about which child were opened ...) oldChild should be modified to refrlect the new object If deep reload is supported and was sucessful, return true, otherwise false.
Note: oldItem should not check or reload its children in this method (at it might lead to multiple reloading of same part of tree) Also, it is guaranteed that reloadSelf will be called on that item, so explicitly reloading the item might be unnecessary too
| childName | name of (old and new) treeitem | |
| oldItem | reference to old child tree item |
Reimplemented from gui::TreeItemAbstract.
References util::convertFromUnicode(), debug::DBG_ERR, pdfobjects::CDict::getProperty(), guiPrintDbg, gui::TreeItem::obj, util::PDF, and gui::TreeItem::setObject().
| QStringList gui::TreeItemDict::getChildNames | ( | ) | [virtual] |
Get list of all item's childs names
Implements gui::TreeItemAbstract.
References util::convertToUnicode(), gui::TreeItemAbstract::data, pdfobjects::CDict::getAllPropertyNames(), pdfobjects::CDict::getProperty(), util::isSimple(), gui::TreeItem::obj, util::PDF, gui::TreeData::showSimple(), and gui::TreeData::sortDict().
| ChildType gui::TreeItemDict::getChildType | ( | const QString & | name | ) | [virtual] |
Get type of this items child, given its name.
| name | Name of child item |
Implements gui::TreeItemAbstract.
References util::convertFromUnicode(), debug::DBG_ERR, pdfobjects::CDict::getProperty(), guiPrintDbg, gui::TreeItem::obj, and util::PDF.
| QSCObject * gui::TreeItemDict::getQSObject | ( | ) | [virtual] |
Create and return object for scripting representing this tree item
Reimplemented from gui::TreeItem.
References gui::TreeData::base(), gui::TreeItemAbstract::data, and gui::TreeItem::obj.
Create and return object for scripting representing this tree item, relocated in different base If the object cannot be copied into new base, return NULL
| _base | BaseCore for the new object. |
Reimplemented from gui::TreeItem.
References gui::TreeItem::obj.
| bool gui::TreeItemDict::haveChild | ( | ) | [virtual] |
Return true, if the item have at least one child
Implements gui::TreeItemAbstract.
References pdfobjects::CDict::getPropertyCount(), and gui::TreeItem::obj.
| void gui::TreeItemDict::remove | ( | const QString & | name | ) |
Remove property with given name from dictionary
| name | Name of property to remove |
References util::convertFromUnicode(), gui::TreeItemAbstract::data, debug::DBG_DBG, guiPrintDbg, gui::TreeItemAbstract::items, gui::TreeItem::obj, util::PDF, Q_OUT, gui::TreeData::tree(), and gui::TreeItemAbstract::unSelect().
| bool gui::TreeItemDict::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.
References util::convertFromUnicode(), debug::DBG_ERR, gui::TreeItem::getObject(), pdfobjects::CDict::getProperty(), guiPrintDbg, gui::TreeItem::obj, and util::PDF.