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
qqstylekitglobal.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
5
7
8PropertyPathId::PropertyPathId(
9 const QQSK::Property property,
10 const PropertyPathId_t groupStart,
11 QQSK::PropertyGroup subtype)
12 : m_property(property)
13{
14 /* Each style property in StyleKit needs a unique PropertyStorageId that can be used as
15 * a key in the map that stores its value. To compute such an ID, we must consider the
16 * property’s full nested path, since properties like 'background.color' and
17 * 'background.border.color' refer to different values.
18 *
19 * Because a property may have multiple values depending on the control’s state and
20 * subtype, we distinguish between a property’s path ID and its storage ID. The path
21 * ID represents the portion of the property path that does not vary during lookups.
22 * For example, in the full path:
23 *
24 * "button.pressed.indicator.up.background.color"
25 *
26 * the portion that is invariant is:
27 *
28 * "indicator.background.color"
29 *
30 * The other parts of the path—such as the control type ('button'), the state ('pressed'),
31 * and the subtype ('up')—are resolved dynamically by the propagation engine. During lookup,
32 * the engine substitutes these components in decreasing order of specificity. For instance:
33 *
34 * - If the property is not found on 'button', it falls back to 'abstractButton'.
35 * - If it is not found in the 'pressed' state, it falls back to 'normal'.
36 * - If it is not found in the 'up' subtype, it falls back to 'indicator'.
37 *
38 * These varying components are prepended in sequence by the propagation engine to form
39 * the final PropertyStorageId, which uniquely identifies the stored value in the map.
40 *
41 * Note that a property path may also include groups known as Options. These are not part
42 * of the Path ID or the Storage ID; they are simply flags used by QQStyleKitPropertyResolver
43 * to control how a property should be read.
44 *
45 * In general, the structure of a property path is:
46 *
47 * control.options.states.subtype.nested_group_path.property
48 *
49 * However, for API convenience, subtypes are written inside the delegate they belong to.
50 * For example, although the storage path is "spinBox.up.indicator.background.color", the
51 * style syntax is "spinBox.indicator.up.background.color". */
52 const PropertyPathId_t subtypeIndex = PropertyPathId_t(subtype)
53 - PropertyPathId_t(QQSK::PropertyGroup::DelegateSubtype0);
54 const PropertyPathId_t subtypeStart = subtypeIndex * subtypeStorageSpaceSize;
55 m_groupStart = subtypeStart + groupStart;
56}
57
58QT_END_NAMESPACE
59
60#include "moc_qqstylekitglobal_p.cpp"
Combined button and popup list for selecting options.