Version: 8.3.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
CurveCreator_TreeView.h
Go to the documentation of this file.
1
// Copyright (C) 2013-2016 CEA/DEN, EDF R&D, 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 CURVECREATOR_TREEVIEW_H
21
#define CURVECREATOR_TREEVIEW_H
22
23
#include <QTreeView>
24
#include <QAbstractItemModel>
25
26
class
CurveCreator_ICurve
;
27
28
class
CurveCreator_TreeViewModel
:
public
QAbstractItemModel
29
{
30
public
:
31
CurveCreator_TreeViewModel
(
CurveCreator_ICurve
* theCurve,
QObject
*
parent
);
32
virtual
int
columnCount
(
const
QModelIndex & parent = QModelIndex())
const
;
33
virtual
int
rowCount
(
const
QModelIndex & parent = QModelIndex())
const
;
34
virtual
QVariant
data
(
const
QModelIndex &
index
,
int
role = Qt::DisplayRole)
const
;
35
virtual
QModelIndex
index
(
int
row,
int
column,
const
QModelIndex & parent = QModelIndex())
const
;
36
virtual
QModelIndex
parent
(
const
QModelIndex & theIndex)
const
;
37
// virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole);
38
39
QModelIndex
sectionIndex
(
int
theSection )
const
;
40
QModelIndex
nbPointsIndex
(
int
theSection )
const
;
41
QModelIndex
pointIndex
(
int
theSection,
int
thePoint )
const
;
42
43
bool
isSection
(
const
QModelIndex& theIndx )
const
;
44
int
getSection
(
const
QModelIndex& theIndx )
const
;
45
int
getPoint
(
const
QModelIndex& theIndx )
const
;
46
47
void
setCurve
(
CurveCreator_ICurve
* theCurve );
48
49
private
:
50
enum
IconType
{
ICON_POLYLINE
,
ICON_SPLINE
,
ICON_CLOSED_SPLINE
,
ICON_CLOSED_POLYLINE
,
ICON_POINT
};
51
private
:
52
CurveCreator_ICurve
*
myCurve
;
53
QMap<IconType, QPixmap>
myCachedIcons
;
54
};
55
56
class
CurveCreator_TreeView
:
public
QTreeView
57
{
58
Q_OBJECT
59
public
:
60
enum
SelectionType
{
ST_NOSEL
,
ST_POINTS
,
ST_POINTS_ONE_SECTION
,
ST_SECTIONS
,
ST_MIXED
};
61
public
:
62
explicit
CurveCreator_TreeView
(
CurveCreator_ICurve
* theCurve,
QWidget
*parent = 0);
63
SelectionType
getSelectionType
()
const
;
64
QList<int>
getSelectedSections
()
const
;
65
66
void
pointsAdded
(
int
theSection,
int
thePoint,
int
thePointsCnt=1 );
67
void
pointDataChanged
(
int
theSection,
int
thePoint );
68
void
pointsRemoved
(
int
theSection,
int
thePoint,
int
thePointsCnt=1 );
69
70
void
sectionAdded
(
int
theSection );
71
void
sectionChanged
(
int
theSection ,
int
aSectCnt = 1);
72
void
sectionsRemoved
(
int
theSection,
int
theSectionCnt=1 );
73
void
sectionsSwapped
(
int
theSection,
int
theOffset );
74
75
void
setSelectedSections
(
const
QList<int>& theList );
76
77
void
setCurve
(
CurveCreator_ICurve
* theCurve );
78
79
void
reset
();
80
81
signals:
82
void
selectionChanged
();
83
void
sectionEntered
(
int
);
84
85
protected
slots:
86
void
onActivated
( QModelIndex theIndx );
87
protected
:
88
void
setIndexState
(
const
QModelIndex& theIndx,
bool
& isExpanded,
bool
& isSelected,
bool
& isCurrent );
89
void
swapIndexes
(
const
QModelIndex& theFirst,
const
QModelIndex& theSecond );
90
void
getIndexInfo
(
const
QModelIndex& theIndx,
bool
& isExpanded,
bool
& isSelected,
bool
& isCurrent );
91
92
};
93
94
#endif // CURVECREATOR_TREEVIEW_H
src
CurveCreator
CurveCreator_TreeView.h
Copyright © 2007-2017 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS