Kirigami2

enums.h
1 /*
2  * SPDX-FileCopyrightText: 2016 Marco Martin <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 #ifndef ENUMS_H
8 #define ENUMS_H
9 
10 #include <QObject>
11 
12 class ApplicationHeaderStyle : public QObject
13 {
14  Q_OBJECT
15 
16 public:
17  enum Status {
18  Auto = 0,
19  Breadcrumb,
20  Titles,
21  TabBar,
22  ToolBar, ///@since 5.48
23  None, ///@since 5.48
24  };
25  Q_ENUM(Status)
26 
27  enum NavigationButton {
28  NoNavigationButtons = 0,
29  ShowBackButton = 0x1,
30  ShowForwardButton = 0x2,
31  };
32  Q_ENUM(NavigationButton)
33  Q_DECLARE_FLAGS(NavigationButtons, NavigationButton)
34 };
35 
36 class MessageType : public QObject
37 {
38  Q_OBJECT
39 
40 public:
41  enum Type {
42  Information = 0,
43  Positive,
44  Warning,
45  Error,
46  };
47  Q_ENUM(Type)
48 };
49 
50 class DisplayHint : public QObject
51 {
52  Q_OBJECT
53 
54 public:
55  /**
56  * Hints for implementations using Actions indicating preferences about how to display the action.
57  */
58  enum Hint : uint {
59  /**
60  * Indicates there is no specific preference.
61  */
62  NoPreference = 0,
63  /**
64  * Only display an icon for this Action.
65  */
66  IconOnly = 1,
67  /**
68  * Try to keep the action visible even when space constrained.
69  * Mutually exclusive with AlwaysHide, KeepVisible has priority.
70  */
71  KeepVisible = 2,
72  /**
73  * If possible, hide the action in an overflow menu or similar location.
74  * Mutually exclusive with KeepVisible, KeepVisible has priority.
75  */
76  AlwaysHide = 4,
77  /**
78  * When this action has children, do not display any indicator (like a
79  * menu arrow) for this action.
80  */
81  HideChildIndicator = 8,
82  };
83  Q_DECLARE_FLAGS(DisplayHints, Hint)
84  Q_ENUM(Hint)
85  Q_FLAG(DisplayHints)
86 
87  // Note: These functions are instance methods because they need to be
88  // exposed to QML. Unfortunately static methods are not supported.
89 
90  /**
91  * Helper function to check if a certain display hint has been set.
92  *
93  * This function is mostly convenience to enforce certain behaviour of the
94  * various display hints, primarily the mutual exclusivity of KeepVisible
95  * and AlwaysHide.
96  *
97  * @param values The display hints to check.
98  * @param hint The display hint to check if it is set.
99  *
100  * @return true if the hint was set for this action, false if not.
101  *
102  * @since 2.14
103  */
104  Q_INVOKABLE bool displayHintSet(DisplayHints values, Hint hint);
105 
106  /**
107  * Check if a certain display hint has been set on an object.
108  *
109  * This overloads @f displayHintSet(DisplayHints, Hint) to accept a QObject
110  * instance. This object is checked to see if it has a displayHint property
111  * and if so, if that property has @p hint set.
112  *
113  * @param object The object to check.
114  * @param hint The hint to check for.
115  *
116  * @return false if object is null, object has no displayHint property or
117  * the hint was not set. true if it has the property and the hint is
118  * set.
119  */
120  Q_INVOKABLE bool displayHintSet(QObject *object, Hint hint);
121 
122  /**
123  * Static version of \f displayHintSet(DisplayHints, Hint) that can be
124  * called from C++ code.
125  */
126  static bool isDisplayHintSet(DisplayHints values, Hint hint);
127 };
128 
129 Q_DECLARE_OPERATORS_FOR_FLAGS(DisplayHint::DisplayHints)
130 
131 #endif // ENUMS_H
Q_OBJECTQ_OBJECT
Q_ENUM(...)
Q_INVOKABLEQ_INVOKABLE
Q_FLAG(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:14:23 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.