QElectroTech
0.100.0-dev
Loading...
Searching...
No Matches
sources
qetgraphicsitem
ViewItem
qetgraphicsheaderitem.h
Go to the documentation of this file.
1
/*
2
Copyright 2006-2024 The QElectroTech Team
3
This file is part of QElectroTech.
4
5
QElectroTech is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 2 of the License, or
8
(at your option) any later version.
9
10
QElectroTech is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
#ifndef QETGRAPHICSHEADERITEM_H
19
#define QETGRAPHICSHEADERITEM_H
20
21
#include "../../qetapp.h"
22
23
#include <QFont>
24
#include <QGraphicsObject>
25
#include <QMargins>
26
27
class
QAbstractItemModel;
28
40
class
QetGraphicsHeaderItem
:
public
QGraphicsObject
41
{
42
Q_OBJECT
43
44
public
:
45
QetGraphicsHeaderItem
(QGraphicsItem *parent =
nullptr
);
46
47
enum
{
Type
= UserType + 1301 };
48
int
type
()
const override
{
return
Type
; }
49
50
void
setModel
(QAbstractItemModel *
model
=
nullptr
);
51
QAbstractItemModel *
model
()
const
;
52
53
virtual
QRectF
boundingRect
()
const override
;
54
virtual
void
paint
(
55
QPainter *painter,
56
const
QStyleOptionGraphicsItem *option,
57
QWidget *widget)
override
;
58
QRect
rect
()
const
;
59
void
resizeSection
(
int
logicalIndex,
int
size);
60
int
sectionSize
(
int
logical_index)
const
;
61
QVector<int>
minimumSectionWidth
()
const
62
{
return
m_sections_minimum_width
;}
63
int
minimumWidth
()
const
64
{
return
m_minimum_width
;}
65
66
QDomElement
toXml
(QDomDocument &document)
const
;
67
void
fromXml
(
const
QDomElement &element);
68
static
QString
xmlTagName
() {
return
QString(
"graphics_header"
);}
69
virtual
bool
toDXF
(
const
QString &filepath);
70
71
signals:
72
void
sectionResized
(
int
logicalIndex,
int
size);
73
void
heightResized
();
74
75
private
:
76
void
setUpMinimumSectionsSize
();
77
void
setUpBoundingRect
();
78
void
headerDataChanged
(
79
Qt::Orientations orientation,
80
int
first,
81
int
last);
82
void
adjustSize
();
83
void
modelReseted
();
84
85
QRect
m_current_rect
;
86
QRectF
m_bounding_rect
;
87
QPointer<QAbstractItemModel>
m_model
;
88
89
QVector<int>
90
m_sections_minimum_width
,
91
m_current_sections_width
;
92
93
int
94
m_section_height
=1,
95
m_minimum_section_height
=1,
96
m_minimum_width
=1;
97
};
98
99
#endif
// QETGRAPHICSHEADERITEM_H
QetGraphicsHeaderItem
The QetGraphicsHeaderItem class The header have a few parameters to edit her visual aspect....
Definition
qetgraphicsheaderitem.h:41
QetGraphicsHeaderItem::m_sections_minimum_width
QVector< int > m_sections_minimum_width
Definition
qetgraphicsheaderitem.h:90
QetGraphicsHeaderItem::setUpBoundingRect
void setUpBoundingRect()
QetGraphicsHeaderItem::setUpBoundingRect Setup the bounding rect of the item.
Definition
qetgraphicsheaderitem.cpp:401
QetGraphicsHeaderItem::m_model
QPointer< QAbstractItemModel > m_model
Definition
qetgraphicsheaderitem.h:87
QetGraphicsHeaderItem::type
int type() const override
Definition
qetgraphicsheaderitem.h:48
QetGraphicsHeaderItem::heightResized
void heightResized()
QetGraphicsHeaderItem::m_section_height
int m_section_height
Definition
qetgraphicsheaderitem.h:94
QetGraphicsHeaderItem::adjustSize
void adjustSize()
QetGraphicsHeaderItem::adjustSize If needed, this function resize the current height and section acco...
Definition
qetgraphicsheaderitem.cpp:430
QetGraphicsHeaderItem::m_minimum_section_height
int m_minimum_section_height
Definition
qetgraphicsheaderitem.h:95
QetGraphicsHeaderItem::fromXml
void fromXml(const QDomElement &element)
QetGraphicsHeaderItem::fromXml Restore the header from xml.
Definition
qetgraphicsheaderitem.cpp:330
QetGraphicsHeaderItem::resizeSection
void resizeSection(int logicalIndex, int size)
QetGraphicsHeaderItem::resizeSection.
Definition
qetgraphicsheaderitem.cpp:251
QetGraphicsHeaderItem::setModel
void setModel(QAbstractItemModel *model=nullptr)
QetGraphicsHeaderItem::setModel Set the model presented by this item Since QetGraphicsHeaderItem don'...
Definition
qetgraphicsheaderitem.cpp:45
QetGraphicsHeaderItem::toDXF
virtual bool toDXF(const QString &filepath)
QetGraphicsHeaderItem::toDXF Draw this table to the dxf document.
Definition
qetgraphicsheaderitem.cpp:183
QetGraphicsHeaderItem::rect
QRect rect() const
QetGraphicsHeaderItem::rect.
Definition
qetgraphicsheaderitem.cpp:241
QetGraphicsHeaderItem::toXml
QDomElement toXml(QDomDocument &document) const
QetGraphicsHeaderItem::toXml save the header to xml.
Definition
qetgraphicsheaderitem.cpp:308
QetGraphicsHeaderItem::boundingRect
virtual QRectF boundingRect() const override
QetGraphicsHeaderItem::boundingRect Reimplemented from QGraphicsObject::boundingRect() const;.
Definition
qetgraphicsheaderitem.cpp:89
QetGraphicsHeaderItem::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
QetGraphicsHeaderItem::paint Reimplemented from QGraphicsObject::paint(QPainter *painter,...
Definition
qetgraphicsheaderitem.cpp:101
QetGraphicsHeaderItem::m_bounding_rect
QRectF m_bounding_rect
Definition
qetgraphicsheaderitem.h:86
QetGraphicsHeaderItem::sectionResized
void sectionResized(int logicalIndex, int size)
QetGraphicsHeaderItem::sectionSize
int sectionSize(int logical_index) const
QetGraphicsHeaderItem::sectionSize.
Definition
qetgraphicsheaderitem.cpp:293
QetGraphicsHeaderItem::modelReseted
void modelReseted()
Definition
qetgraphicsheaderitem.cpp:442
QetGraphicsHeaderItem::xmlTagName
static QString xmlTagName()
Definition
qetgraphicsheaderitem.h:68
QetGraphicsHeaderItem::setUpMinimumSectionsSize
void setUpMinimumSectionsSize()
QetGraphicsHeaderItem::setUpMinimumSectionsSize Setup the minimum section size and height of the item...
Definition
qetgraphicsheaderitem.cpp:353
QetGraphicsHeaderItem::model
QAbstractItemModel * model() const
QetGraphicsHeaderItem::model.
Definition
qetgraphicsheaderitem.cpp:79
QetGraphicsHeaderItem::m_current_sections_width
QVector< int > m_current_sections_width
Definition
qetgraphicsheaderitem.h:91
QetGraphicsHeaderItem::minimumWidth
int minimumWidth() const
Definition
qetgraphicsheaderitem.h:63
QetGraphicsHeaderItem::m_minimum_width
int m_minimum_width
Definition
qetgraphicsheaderitem.h:96
QetGraphicsHeaderItem::minimumSectionWidth
QVector< int > minimumSectionWidth() const
Definition
qetgraphicsheaderitem.h:61
QetGraphicsHeaderItem::Type
@ Type
Definition
qetgraphicsheaderitem.h:47
QetGraphicsHeaderItem::m_current_rect
QRect m_current_rect
Definition
qetgraphicsheaderitem.h:85
QetGraphicsHeaderItem::headerDataChanged
void headerDataChanged(Qt::Orientations orientation, int first, int last)
QetGraphicsHeaderItem::headerDataChanged Update the header when data of displayed model change.
Definition
qetgraphicsheaderitem.cpp:413
Generated by
1.9.8