Fix for segfault when deleting MCO (invalid QModelIndex needs to be returned in index(TreeItem*) )
20 class TreeItem:public XMLObj
23 enum Type {Undefined,MapCenter,Branch,Image,Attribute}; //FIXME-3 MapCenter still needed?
24 enum HideTmpMode {HideNone, HideExport};
27 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
31 // General housekeeping
32 virtual void setModel (VymModel *m);
33 virtual VymModel* getModel();
36 /*! Return number of item, as it would be after it would have been appended.
37 This is used to notify view about layout changes before model is modified. */
38 virtual int getRowNumAppend (TreeItem *child);
40 virtual void appendChild (TreeItem *child);
41 virtual void removeChild (int row);
42 // virtual void clear();
44 virtual TreeItem *child(int row);
45 virtual int childCount() const;
46 virtual int childNumber() const;
47 virtual int columnCount() const;
48 virtual int branchCount() const;
49 virtual int imageCount() const;
50 virtual int xlinkCount() const;
51 virtual int attributeCount() const;
53 virtual int row() const;
54 virtual int column() const;
56 virtual TreeItem *parent();
58 /*! Return number of item in parent by type,
59 e.g. first branch has number 0 */
60 virtual int childNum(); //! Return number of item in list of all children
61 virtual int num(); //! Return number of item by type
62 virtual int num (TreeItem *item); //! Return number of item by type
67 virtual void setType (const Type t);
68 virtual Type getType ();
69 virtual bool isBranchLikeType() const;
70 virtual QString getTypeName ();
73 virtual QVariant data(int column) const;
79 virtual void setHeading (const QString s);
80 virtual QString getHeading() const;
81 virtual std::string getHeadingStd() const; //! convenience function used for debugging
82 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
83 virtual QColor getHeadingColor(); //! Returns color of heading
89 void setURL (const QString &url); //! Set URL
90 QString getURL (); //! Get URL
96 void setVymLink (const QString &url); //! Set URL
97 QString getVymLink (); //! Get URL
103 virtual void setNote(const QString &s);
104 virtual void clearNote();
105 virtual QString getNote();
106 virtual bool hasEmptyNote();
107 virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true); //FIXME-1 setNoteObj is called for every select or so???
109 virtual NoteObj getNoteObj();
110 virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII)
111 virtual QString getNoteASCII(); // returns note (ASCII)
112 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
116 FlagRow standardFlags;
119 virtual void activateStandardFlag(const QString &flag);
120 virtual void deactivateStandardFlag(const QString &flag);
121 virtual void deactivateAllStandardFlags();
123 /*! \brief Toggle a Flag
124 If master is not NULL,, only one Flag from FlagRow master may
125 be active simultanously, the others get deactivated.
127 virtual void toggleStandardFlag(const QString &flag, FlagRow *master=NULL);
128 virtual bool isActiveStandardFlag (const QString &flag);
129 virtual QStringList activeStandardFlagNames();
130 virtual FlagRow* getStandardFlagRow ();
132 virtual QStringList activeSystemFlagNames();
134 virtual bool canMoveDown();
135 virtual bool canMoveUp();
138 QString objID; //! id set during load/save currently used for xLinks
140 virtual void setID (const QString &s);
141 virtual QString getID ();
143 // Navigation and selection
144 virtual TreeItem* getChildNum(const int &n);
145 virtual BranchItem* getFirstBranch();
146 virtual BranchItem* getLastBranch();
148 /*! Get next branch after current branch. Return NULL if there is no
150 virtual BranchItem* getNextBranch(BranchItem* currentBranch);
152 virtual BranchItem* getBranchNum(const int &n);
153 virtual BranchObj* getBranchObjNum(const int &n);
155 virtual ImageItem* getImageNum(const int &n);
156 virtual FloatImageObj* getImageObjNum(const int &n);
159 bool hideExport; //! Hide this item in export
161 virtual void setHideTmp (HideTmpMode);
162 virtual bool hasHiddenExportParent ();
163 virtual void setHideInExport(bool); // set export of object (and children)
164 virtual bool hideInExport();
165 virtual bool isHidden ();
167 virtual QString getGeneralAttr();
172 QList<TreeItem*> childItems;
173 QList<QVariant> itemData;
174 TreeItem *parentItem;
176 /*! Set rootItem (does not change, needed for quick check
177 if some branch is mapCenter */
186 int attributeCounter;
188 bool hidden; //! Hidden in export if true