1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // Author: Guillaume Boulant (EDF/R&D)
25 #include "TreeData.hxx"
30 #include <QModelIndex>
32 #include "DataObject.hxx"
33 #include "TreeModel.hxx"
35 class TREEDATA_EXPORT TreeItem
38 TreeItem(const QString &nameId, const QVector<QVariant> &columnValues, TreeItem *parent = 0);
42 void associateToModel(TreeModel * model);
43 TreeModel * associatedModel();
44 QModelIndex modelIndex(int column=0);
47 void appendChild(TreeItem * child);
48 void appendChild(DataObject * dataObject,
49 const QStringList &relativePath=QStringList());
50 void appendChild(const QString &nameId,
51 const QVector<QVariant> &columnValues,
52 const QStringList &relativePath=QStringList());
54 void removeChild(TreeItem * child);
55 void removeChild(DataObject * dataObject,
56 const QStringList &relativePath=QStringList());
58 TreeItem *child(int row);
59 TreeItem *childById(const QString &nameId);
60 TreeItem *childByLabel(const QString &label);
61 int childCount() const;
62 int columnCount() const;
64 QVariant data(int column) const;
65 bool setData(int column, const QVariant &value);
68 void initialize(const QString &nameId,
69 const QVector<QVariant> &columnValues,
72 QList<TreeItem*> _childItems;
73 QMap <QString, TreeItem *> _childItemsMapById;
74 QMap <QString, TreeItem *> _childItemsMapByLabel;
77 QVector<QVariant> _itemData;
78 TreeItem * _parentItem;
79 TreeModel * _associatedModel;