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
qqstylekitcontrolstate.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
6
8
10 : QQStyleKitControlProperties(QQSK::PropertyGroup::Control, parent)
11{
12}
13
15{
16 if (m_nestedState == QQSK::StateFlag::Normal) {
17 Q_ASSERT(qobject_cast<const QQStyleKitControl *>(this));
18 auto *self = const_cast<QQStyleKitControlState *>(this);
19 return static_cast<QQStyleKitControl *>(self);
20 }
21 Q_ASSERT(qobject_cast<const QQStyleKitControl *>(parent()));
22 return static_cast<QQStyleKitControl *>(parent());
23}
24
25QQStyleKitControlState *QQStyleKitControlState::lazyCreateState(QQSK::StateFlag state) const
26{
27 if (m_nestedStateObjects.contains(state))
28 return m_nestedStateObjects.value(state);
29
30 QQStyleKitControlState *stateObj = new QQStyleKitControlState(control());
31 stateObj->m_nestedState = m_nestedState;
32 stateObj->m_nestedState.setFlag(state);
33 stateObj->m_nestedState.setFlag(QQSK::StateFlag::Normal, false);
34
35 auto *self = const_cast<QQStyleKitControlState *>(this);
36 self->m_nestedStateObjects.insert(state, stateObj);
37
38 return stateObj;
39}
40
42{
43 return lazyCreateState(QQSK::StateFlag::Pressed);
44}
45
47{
48 return lazyCreateState(QQSK::StateFlag::Hovered);
49}
50
52{
53 return lazyCreateState(QQSK::StateFlag::Highlighted);
54}
55
57{
58 return lazyCreateState(QQSK::StateFlag::Focused);
59}
60
62{
63 return lazyCreateState(QQSK::StateFlag::Checked);
64}
65
67{
68 return lazyCreateState(QQSK::StateFlag::Vertical);
69}
70
72{
73 return lazyCreateState(QQSK::StateFlag::Disabled);
74}
75
76QT_END_NAMESPACE
77
78#include "moc_qqstylekitcontrolstate_p.cpp"
\inmodule QtCore
Definition qobject.h:105
QQStyleKitControlState * checked() const
QQStyleKitControlState * hovered() const
QQStyleKitControlState * vertical() const
QQStyleKitControl * control() const
QQStyleKitControlState * disabled() const
QQStyleKitControlState * focused() const
QQStyleKitControlState * pressed() const
QQStyleKitControlState * highlighted() const
Combined button and popup list for selecting options.