Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickstyleitemcheckdelegate.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 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
6
7#include <QtQuickTemplates2/private/qquickcheckdelegate_p.h>
8
10
11void QQuickStyleItemCheckDelegate::connectToControl() const
12{
13 QQuickStyleItem::connectToControl();
14 auto checkDelegate = control<QQuickCheckDelegate>();
15 connect(checkDelegate, &QQuickCheckDelegate::downChanged, this, &QQuickStyleItem::markImageDirty);
16 connect(checkDelegate, &QQuickCheckDelegate::checkStateChanged, this, &QQuickStyleItem::markImageDirty);
17}
18
19void QQuickStyleItemCheckDelegate::initStyleOption(QStyleOptionButton &styleOption) const
20{
21 initStyleOptionBase(styleOption);
22 auto checkDelegate = control<QQuickCheckDelegate>();
23
24 styleOption.state |= checkDelegate->isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
25 if (checkDelegate->isTristate() && checkDelegate->checkState() == Qt::PartiallyChecked)
26 styleOption.state |= QStyle::State_NoChange;
27 else
28 styleOption.state |= checkDelegate->isChecked() ? QStyle::State_On : QStyle::State_Off;
29}
30
31QT_END_NAMESPACE
32
33#include "moc_qquickstyleitemcheckdelegate.cpp"
void initStyleOption(QStyleOptionButton &styleOption) const override