Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickstyleitemtreeindicator.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 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
5
7
9{
11 auto delegate = control<QQuickTreeViewDelegate>();
13}
14
16{
17 QStyleOptionViewItem styleOption;
18 initStyleOption(styleOption);
19 StyleItemGeometry geometry;
20
21 geometry.minimumSize = QSize(20, 20);
22 geometry.implicitSize = geometry.minimumSize;
23 styleOption.rect = QRect(QPoint(0, 0), geometry.implicitSize);
24
25 return geometry;
26}
27
29{
30 QStyleOptionViewItem styleOption;
31 initStyleOption(styleOption);
32 style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, painter);
33}
34
35void QQuickStyleItemTreeIndicator::initStyleOption(QStyleOptionViewItem &styleOption) const
36{
37 initStyleOptionBase(styleOption);
38 auto delegate = control<QQuickTreeViewDelegate>();
39
40 styleOption.state |= QStyle::State_Children;
41
42 if (delegate->expanded())
43 styleOption.state |= QStyle::State_Open;
44}
45
47
48#include "moc_qquickstyleitemtreeindicator.cpp"
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:25
StyleItemGeometry calculateGeometry() override
void paintEvent(QPainter *painter) const override
virtual void connectToControl() const
void initStyleOptionBase(QStyleOption &styleOption) const
static QStyle * style()
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
@ State_Children
Definition qstyle.h:86
@ State_Open
Definition qstyle.h:85
@ PE_IndicatorBranch
Definition qstyle.h:128
Combined button and popup list for selecting options.
QPainter painter(this)
[7]