anatomist 6.0.4
3D neuroimaging data viewer
qObjTree.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34
35#ifndef ANAQT_CONTROL_QOBJTREE_H
36#define ANAQT_CONTROL_QOBJTREE_H
37
38
39#include <qtreewidget.h>
40#include <map>
41#include <string>
42#include <set>
43
44class QPixmap;
45class QTreeWidget;
46class QTreeWidgetItem;
47
48namespace anatomist
49{
50 class AObject;
51 class MObject;
52}
53
54
57class QObjectTree : public QWidget
58{
59 Q_OBJECT
60
61public:
62 QObjectTree( QWidget *parent, const char *name );
63 virtual ~QObjectTree();
64
66 virtual void RegisterObject( anatomist::AObject* obj );
75 anatomist::AObject *obj );
77 anatomist::AObject *obj );
78
79 virtual std::set<anatomist::AObject *> *SelectedObjects() const;
80 virtual anatomist::AObject* ObjectOfNumber( unsigned pos ) const;
81 virtual void SelectObject( anatomist::AObject *obj );
82 virtual bool isObjectSelected( anatomist::AObject* obj ) const;
83 virtual void UnselectAll();
84 bool hasObject( anatomist::AObject *obj ) const;
85
87 virtual bool ViewingRefColors() const;
88 virtual void ToggleRefColorsView();
89 virtual void DisplayRefColors();
90 virtual void UndisplayRefColors();
91
92
93 static void setObjectTypeName(int type, const std::string &name);
94 static void setObjectTypeIcon(int type, const std::string &img);
95
96 static unsigned RefPixSize;
97 static std::map<int, QPixmap> TypeIcons;
98 static std::map<int, std::string> TypeNames;
99
100signals:
102 void rightButtonPressed( anatomist::AObject*, const QPoint & );
103
104public slots:
105 virtual void startDragging( QTreeWidgetItem*, Qt::MouseButtons,
106 Qt::KeyboardModifiers );
107 void rightButtonPressed( QTreeWidgetItem*, const QPoint & );
108 void objectRenamed( QTreeWidgetItem*, int );
109 void sortIndicatorChanged( int, Qt::SortOrder );
110
111protected slots:
113
114protected:
115 virtual void registerSubObjects( QTreeWidgetItem* li,
116 anatomist::MObject* mobj );
117 virtual void unregisterSubObjects( QTreeWidgetItem* li );
118 virtual QTreeWidgetItem* insertObject( QTreeWidgetItem* item,
119 anatomist::AObject* obj );
120 virtual QTreeWidgetItem* insertObject( QTreeWidget* lview,
121 anatomist::AObject* obj );
122 virtual void decorateItem( QTreeWidgetItem* item, anatomist::AObject* obj );
123 virtual void dragEnterEvent( QDragEnterEvent* );
124 virtual void dragMoveEvent( QDragMoveEvent* );
125 virtual void dropEvent( QDropEvent* );
126
127 static void initIcons();
128
129 std::multimap<anatomist::AObject *, QTreeWidgetItem *> _objects;
130 std::map<QTreeWidgetItem *, anatomist::AObject *> _items;
131 QTreeWidget *_lview;
133 unsigned _count;
134
135private:
136};
137
138
139#endif
#define slots
virtual QTreeWidgetItem * insertObject(QTreeWidget *lview, anatomist::AObject *obj)
virtual QTreeWidgetItem * insertObject(QTreeWidgetItem *item, anatomist::AObject *obj)
static void setObjectTypeIcon(int type, const std::string &img)
void selectionChanged()
bool _viewRefCol
Definition qObjTree.h:132
virtual void decorateItem(QTreeWidgetItem *item, anatomist::AObject *obj)
void unselectInvisibleItems()
virtual void unregisterSubObjects(QTreeWidgetItem *li)
void rightButtonPressed(QTreeWidgetItem *, const QPoint &)
static unsigned RefPixSize
Definition qObjTree.h:96
virtual void UnselectAll()
unsigned _count
Definition qObjTree.h:133
virtual void SelectObject(anatomist::AObject *obj)
QTreeWidget * _lview
Definition qObjTree.h:131
std::multimap< anatomist::AObject *, QTreeWidgetItem * > _objects
Definition qObjTree.h:129
void rightButtonPressed(anatomist::AObject *, const QPoint &)
static std::map< int, std::string > TypeNames
Definition qObjTree.h:98
virtual void RegisterObject(anatomist::AObject *obj)
adds the object at the base level of this tree
virtual void dropEvent(QDropEvent *)
virtual void UndisplayRefColors()
virtual void ToggleRefColorsView()
static void setObjectTypeName(int type, const std::string &name)
virtual void dragMoveEvent(QDragMoveEvent *)
virtual bool isObjectSelected(anatomist::AObject *obj) const
virtual std::set< anatomist::AObject * > * SelectedObjects() const
virtual void NotifyObjectChange(anatomist::AObject *obj)
void sortIndicatorChanged(int, Qt::SortOrder)
virtual anatomist::AObject * ObjectOfNumber(unsigned pos) const
QObjectTree(QWidget *parent, const char *name)
void objectRenamed(QTreeWidgetItem *, int)
virtual void startDragging(QTreeWidgetItem *, Qt::MouseButtons, Qt::KeyboardModifiers)
virtual void DisplayRefColors()
std::map< QTreeWidgetItem *, anatomist::AObject * > _items
Definition qObjTree.h:130
virtual bool ViewingRefColors() const
Are reference colors markers visible ?
virtual void UnregisterSubObject(anatomist::MObject *mobj, anatomist::AObject *obj)
virtual void RegisterSubObject(anatomist::MObject *mobj, anatomist::AObject *obj)
adds the object in a sub-tree.
virtual void UnregisterObject(anatomist::AObject *obj)
virtual void registerSubObjects(QTreeWidgetItem *li, anatomist::MObject *mobj)
static std::map< int, QPixmap > TypeIcons
Definition qObjTree.h:97
virtual ~QObjectTree()
static void initIcons()
bool hasObject(anatomist::AObject *obj) const
virtual void dragEnterEvent(QDragEnterEvent *)
Base Anatomist object (abstract)
Definition Object.h:97
Multi-object : base abstract class for objects that contain others.
Definition MObject.h:235