Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquickheaderviewdelegate.cpp
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qquickheaderviewdelegate_p.h"
6
7
#
include
<
QtQuickTemplates2
/
private
/
qquickheaderview_p
.
h
>
8
#
include
<
QtQuickTemplates2
/
private
/
qquickheaderview_p_p
.
h
>
9
#
include
<
QtQuickTemplates2
/
private
/
qquicktableviewdelegate_p_p
.
h
>
10
11
/*!
12
\qmltype HorizontalHeaderViewDelegate
13
\inherits TableViewDelegate
14
\inqmlmodule QtQuick.Controls
15
\since 6.10
16
\ingroup qtquickcontrols-delegates
17
18
\image qtquickcontrols-headerviewdelegate.png
19
{Header view delegate in table column header}
20
21
The HorizontalHeaderViewDelegate serves as the default delegate
22
automatically assigned to the \l HorizontalHeaderView's
23
\l {TableView::delegate} {delegate property}.
24
This delegate handles rendering every header cell using the
25
application's predefined style specifications.
26
27
HorizontalHeaderViewDelegate inherits TableViewDelegate, which means
28
that it's composed of two items:
29
a \l[QML]{Control::}{background} and
30
a \l [QML]{Control::}{contentItem}.
31
32
\sa {Customizing HeaderViewDelegate}, {HorizontalHeaderView}
33
*/
34
35
/*!
36
\qmltype VerticalHeaderViewDelegate
37
\inherits TableViewDelegate
38
\inqmlmodule QtQuick.Controls
39
\since 6.10
40
\ingroup qtquickcontrols-delegates
41
42
\image qtquickcontrols-headerviewdelegate.png
43
{Header view delegate in table column header}
44
45
The VerticalHeaderViewDelegate serves as the default delegate
46
automatically assigned to the \l VerticalHeaderView's
47
\l {TableView::delegate} {delegate property}.
48
This delegate handles rendering every header cell using the
49
application's predefined style specifications.
50
51
VerticalHeaderViewDelegate inherits TableViewDelegate, which means
52
that it's composed of two items:
53
a \l[QML]{Control::}{background} and
54
a \l [QML]{Control::}{contentItem}.
55
56
\sa {Customizing HeaderViewDelegate}, {VerticalHeaderView}
57
*/
58
59
/*!
60
\qmlproperty HeaderView QtQuick.Controls::HorizontalHeaderViewDelegate::headerView
61
62
This property points to the \l HorizontalHeaderView that contains the delegate item.
63
*/
64
65
/*!
66
\qmlproperty HeaderView QtQuick.Controls::VerticalHeaderViewDelegate::headerView
67
68
This property points to the \l VerticalHeaderView that contains the delegate item.
69
*/
70
71
/*!
72
\qmlproperty Qt::Orientations QtQuick.Controls::HorizontalHeaderViewDelegate::orientation
73
74
This property has the same value of the headerView's orientation.
75
*/
76
77
/*!
78
\qmlproperty Qt::Orientations QtQuick.Controls::VerticalHeaderViewDelegate::orientation
79
80
This property has the same value of the headerView's orientation.
81
*/
82
83
84
QT_BEGIN_NAMESPACE
85
86
class
QQuickHeaderViewDelegatePrivate
:
public
QQuickTableViewDelegatePrivate
87
{
88
public
:
89
Q_DECLARE_PUBLIC(QQuickHeaderViewDelegate)
90
91
public
:
92
QPointer
<
QQuickHeaderViewBase
>
headerView
;
93
QVariant
model
;
94
};
95
96
QQuickHeaderViewDelegate::QQuickHeaderViewDelegate(QQuickItem *parent)
97
: QQuickTableViewDelegate(*(
new
QQuickHeaderViewDelegatePrivate), parent)
98
{
99
}
100
101
QQuickHeaderViewBase *QQuickHeaderViewDelegate::headerView()
const
102
{
103
return
d_func()->headerView;
104
}
105
106
Qt::Orientation QQuickHeaderViewDelegate::orientation()
const
107
{
108
return
headerView()
109
? QQuickHeaderViewBasePrivate::get(headerView())->orientation()
110
: Qt::Horizontal;
111
}
112
113
void
QQuickHeaderViewDelegate::setHeaderView(QQuickHeaderViewBase *headerView)
114
{
115
Q_D(QQuickHeaderViewDelegate);
116
if
(d->headerView == headerView)
117
return
;
118
119
const
Qt::Orientation oldOrientation = orientation();
120
121
d->headerView = headerView;
122
emit headerViewChanged();
123
124
if
(oldOrientation != orientation())
125
emit orientationChanged();
126
}
127
128
QVariant QQuickHeaderViewDelegate::model()
const
129
{
130
return
d_func()->model;
131
}
132
133
void
QQuickHeaderViewDelegate::setModel(
const
QVariant &model)
134
{
135
Q_D(QQuickHeaderViewDelegate);
136
if
(d->model == model)
137
return
;
138
d->model = model;
139
emit modelChanged();
140
}
141
142
QT_END_NAMESPACE
143
144
#
include
"moc_qquickheaderviewdelegate_p.cpp"
QQuickHeaderViewDelegatePrivate
\qmltype HorizontalHeaderViewDelegate \inherits TableViewDelegate \inqmlmodule QtQuick....
Definition
qquickheaderviewdelegate.cpp:87
QQuickHeaderViewDelegatePrivate::model
QVariant model
Definition
qquickheaderviewdelegate.cpp:93
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
quicktemplates
qquickheaderviewdelegate.cpp
Generated on
for Qt by
1.18.0