Kirigami2

displayhint.cpp
1/*
2 * SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "displayhint.h"
8
9#include "moc_displayhint.cpp"
10
11#include <QVariant>
12
13bool DisplayHint::displayHintSet(DisplayHints values, Hint hint)
14{
15 return isDisplayHintSet(values, hint);
16}
17
18bool DisplayHint::displayHintSet(QObject *object, DisplayHint::Hint hint)
19{
20 if (!object) {
21 return false;
22 }
23
24 auto property = object->property("displayHint");
25 if (property.isValid()) {
26 return isDisplayHintSet(DisplayHints{property.toInt()}, hint);
27 } else {
28 return false;
29 }
30}
31
32bool 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}
QAction * hint(const QObject *recvr, const char *slot, QObject *parent)
QVariant property(const char *name) const const
bool isValid() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:51:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.