1 | /* |
---|---|
2 | * SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org> |
3 | * |
4 | * SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #include "enums.h" |
8 | |
9 | #include "moc_enums.cpp" |
10 | |
11 | #include <QVariant> |
12 | |
13 | bool DisplayHint::displayHintSet(DisplayHints values, Hint hint) |
14 | { |
15 | return isDisplayHintSet(values, hint); |
16 | } |
17 | |
18 | bool DisplayHint::displayHintSet(QObject *object, DisplayHint::Hint hint) |
19 | { |
20 | if (!object) { |
21 | return false; |
22 | } |
23 | |
24 | auto property = object->property(name: "displayHint"); |
25 | if (property.isValid()) { |
26 | return isDisplayHintSet(values: DisplayHints{property.toInt()}, hint); |
27 | } else { |
28 | return false; |
29 | } |
30 | } |
31 | |
32 | bool DisplayHint::isDisplayHintSet(DisplayHint::DisplayHints values, DisplayHint::Hint hint) |
33 | { |
34 | if (hint == DisplayHint::AlwaysHide && (values & DisplayHint::KeepVisible)) { |
35 | return false; |
36 | } |
37 | |
38 | return values & hint; |
39 | } |
40 |