Version: 9.16.0
GEOMGUI_TextTreeWdg.h
Go to the documentation of this file.
1// Copyright (C) 2015-2026 CEA, EDF, OPEN CASCADE
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef GEOMGUI_TEXTTREEWDG_H
21#define GEOMGUI_TEXTTREEWDG_H
22
23#include "GEOM_GEOMGUI.hxx"
24#include "GEOM_Displayer.h"
25
26#include <QHash>
27#include <QMap>
28#include <QList>
29#include <QSharedPointer>
30#include <QTreeWidget>
31
32#include <SALOMEDSClient.hxx>
33
34class QLabel;
35class QLineEdit;
36class QString;
37class QTreeWidgetItem;
38class SalomeApp_Application;
39class SalomeApp_Study;
40
47{
48 Q_OBJECT
49
50public:
51 enum BranchType { DimensionShape, AnnotationShape };
52
53public:
54 GEOMGUI_TextTreeWdg( SalomeApp_Application* app );
56
57 int getWinID() { return myWindowID; }
58
59 void removeBranch( const BranchType& theBranchType, const QString& theEntry,
60 bool force = true );
61 int idFromItem( QTreeWidgetItem* theItem );
62 QString entryFromItem( QTreeWidgetItem* theShapeItem ) const;
63 QTreeWidgetItem* itemFromEntry( const BranchType& theBranchType, QString theEntry );
64 void setAllShapeItemsVisibility( const BranchType& theBranchType,
65 const QString& theEntry,
66 const bool theVisibility );
67 void setShapeItemVisibility( const BranchType& theBranchType,
68 const QString& theEntry,
69 QTreeWidgetItem* theWidgetItem,
70 const bool theVisibility );
71 void updateVisibility();
72
73 void getSelected( QMap<QString, QList<int> >& theAnnotations );
74 void setSelected( const QMap<QString, QList<int> >& theAnnotations );
75
76 QList<QString> getAllEntries( const BranchType& theBranchType );
77
78 QString getSingleSelectedObject();
79
80protected:
81 void createActions();
82 void redisplay( QString theEntry );
83
84public slots:
85 void updateTree();
86 void updateBranches( const QString& theEntry );
87 void updateDimensionBranch( const QString& theEntry );
88 void updateAnnotationBranch( const QString& theEntry );
89 void updateObjectName( const QString& theEntry );
90
91private slots:
92 void onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
93 void onItemClicked(QTreeWidgetItem*, int );
94 void setVisibility( QTreeWidgetItem* theItem, bool visibility );
95 void showContextMenu( const QPoint& pos );
96
97public:
98
104 {
105 public:
106 virtual int GetNumber() = 0;
107 virtual QString GetName( const int theIndex ) = 0;
108 virtual bool GetIsVisible( const int theIndex ) = 0;
109 virtual void SetIsVisible( const int theIndex, const bool theIsVisible ) = 0;
110 virtual void Save() = 0;
111 };
112
113private:
114 bool setShapeItemVisibility( QSharedPointer<VisualProperty>& theProps,
115 QTreeWidgetItem* theWidgetItem,
116 const bool theVisibility );
117 QSharedPointer<VisualProperty> getVisualProperty( const BranchType& theBranchType,
118 SalomeApp_Study* theStudy,
119 const std::string& theEntry );
120 void fillBranch( const BranchType& theBranchType,
121 const QString& theEntry );
122 void updateVisibilityColumn( const BranchType& theBranchType,
123 QString theEntry,
124 Qtx::VisibilityState theState );
125 QTreeWidgetItem* getPropertyRootItem( const BranchType& theBranchType );
126 QHash<QString, QTreeWidgetItem*>& getObjects( const BranchType& theBranchType );
127 BranchType branchTypeFromItem( QTreeWidgetItem* theItem );
128
129private:
130
134 QHash<QString, QTreeWidgetItem*> myDimensionObjects;
135 QHash<QString, QTreeWidgetItem*> myAnnotationObjects;
136 SalomeApp_Study* myStudy;
140 QMap<int, QAction*> myActions;
141};
142
143#endif
#define GEOMGUI_EXPORT
Definition: GEOM_GEOMGUI.hxx:36
Common interface for working with shape dimension and annotation properties of object in a unified wa...
Definition: GEOMGUI_TextTreeWdg.h:104
virtual bool GetIsVisible(const int theIndex)=0
virtual QString GetName(const int theIndex)=0
virtual void SetIsVisible(const int theIndex, const bool theIsVisible)=0
Tree view contains Dimension and Annotation text items:
Definition: GEOMGUI_TextTreeWdg.h:47
QHash< QString, QTreeWidgetItem * > myDimensionObjects
Definition: GEOMGUI_TextTreeWdg.h:134
QIcon myInvisibleIcon
Definition: GEOMGUI_TextTreeWdg.h:133
int myWindowID
Definition: GEOMGUI_TextTreeWdg.h:131
BranchType
Definition: GEOMGUI_TextTreeWdg.h:51
GEOM_Displayer myDisplayer
Definition: GEOMGUI_TextTreeWdg.h:139
QTreeWidgetItem * myAnnotationsItem
Definition: GEOMGUI_TextTreeWdg.h:138
SalomeApp_Study * myStudy
Definition: GEOMGUI_TextTreeWdg.h:136
int getWinID()
Definition: GEOMGUI_TextTreeWdg.h:57
QHash< QString, QTreeWidgetItem * > myAnnotationObjects
Definition: GEOMGUI_TextTreeWdg.h:135
QMap< int, QAction * > myActions
menu actions list
Definition: GEOMGUI_TextTreeWdg.h:140
QTreeWidgetItem * myDimensionsItem
Definition: GEOMGUI_TextTreeWdg.h:137
QIcon myVisibleIcon
Definition: GEOMGUI_TextTreeWdg.h:132
Definition: GEOM_Displayer.h:72