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
4#include "qquickstyleitemradiodelegate.h"
5
6#include <QtQuickTemplates2/private/qquickradiodelegate_p.h>
7
8QT_BEGIN_NAMESPACE
9
10void QQuickStyleItemRadioDelegate::connectToControl() const
11{
12 QQuickStyleItem::connectToControl();
13 auto radioDelegate = control<QQuickRadioDelegate>();
14 connect(sender: radioDelegate, signal: &QQuickRadioDelegate::downChanged, context: this, slot: &QQuickStyleItem::markImageDirty);
15 connect(sender: radioDelegate, signal: &QQuickRadioDelegate::checkedChanged, context: this, slot: &QQuickStyleItem::markImageDirty);
16}
17
18void QQuickStyleItemRadioDelegate::initStyleOption(QStyleOptionButton &styleOption) const
19{
20 initStyleOptionBase(styleOption);
21 auto radioDelegate = control<QQuickRadioDelegate>();
22
23 styleOption.state |= radioDelegate->isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
24 styleOption.state |= radioDelegate->isChecked() ? QStyle::State_On : QStyle::State_Off;
25}
26
27QT_END_NAMESPACE
28
29#include "moc_qquickstyleitemradiodelegate.cpp"
30

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtdeclarative/src/quicknativestyle/items/qquickstyleitemradiodelegate.cpp