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