KWidgetsAddons

ktogglefullscreenaction.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <[email protected]>
4  SPDX-FileCopyrightText: 1999 Simon Hausmann <[email protected]>
5  SPDX-FileCopyrightText: 2000 Nicolas Hadacek <[email protected]>
6  SPDX-FileCopyrightText: 2000 Kurt Granroth <[email protected]>
7  SPDX-FileCopyrightText: 2000 Michael Koch <[email protected]>
8  SPDX-FileCopyrightText: 2001 Holger Freyther <[email protected]>
9  SPDX-FileCopyrightText: 2002 Ellis Whitehead <[email protected]>
10  SPDX-FileCopyrightText: 2003 Andras Mantia <[email protected]>
11  SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <[email protected]>
12 
13  SPDX-License-Identifier: LGPL-2.0-only
14 */
15 
16 #ifndef KTOGGLEFULLSCREENACTION_H
17 #define KTOGGLEFULLSCREENACTION_H
18 
19 #include <ktoggleaction.h>
20 
21 class QWidget;
22 
23 class KToggleFullScreenActionPrivate;
24 
25 /**
26  * @class KToggleFullScreenAction ktogglefullscreenaction.h KToggleFullScreenAction
27  *
28  * An action for switching between to/from full screen mode. Note that
29  * QWidget::isFullScreen() may reflect the new or the old state
30  * depending on how the action was triggered (by the application or
31  * from the window manager). Also don't try to track the window state
32  * yourself. Rely on this action's state (isChecked()) instead.
33  *
34  * Important: If you need to set/change the fullscreen state manually,
35  * use KToggleFullScreenAction::setFullScreen() or a similar function,
36  * do not call directly the slot connected to the toggled() signal. The slot
37  * still needs to explicitly set the window state though.
38  *
39  * @note Do NOT use QWidget::showFullScreen() or QWidget::showNormal().
40  * They have several side-effects besides just switching the fullscreen
41  * state (for example, showNormal() resets all window states, not just
42  * fullscreen). Use the KToggleFullScreenAction::setFullScreen() helper function.
43  */
44 class KWIDGETSADDONS_EXPORT KToggleFullScreenAction : public KToggleAction
45 {
46  Q_OBJECT
47 
48 public:
49  /**
50  * Create a KToggleFullScreenAction. Call setWindow() to associate this
51  * action with a window.
52  *
53  * @param parent This action's parent object.
54  */
55  explicit KToggleFullScreenAction(QObject *parent);
56 
57  /**
58  * Create a KToggleFullScreenAction
59  * @param window the window that will switch to/from full screen mode
60  * @param parent This action's parent object.
61  */
62  KToggleFullScreenAction(QWidget *window, QObject *parent);
63 
64  /**
65  * Destroys the toggle fullscreen action.
66  */
67  ~KToggleFullScreenAction() override;
68 
69  /**
70  * Sets the window that will be related to this action.
71  */
72  void setWindow(QWidget *window);
73 
74  /**
75  * Helper function to set or reset the fullscreen state of a window.
76  * Use this function rather than showFullScreen()/showNormal() QWidget functions.
77  * @since 4.0.3
78  */
79  static void setFullScreen(QWidget *window, bool set);
80 
81 protected:
82  bool eventFilter(QObject *object, QEvent *event) override;
83 
84 protected Q_SLOTS:
85  void slotToggled(bool checked) override;
86 
87 private:
88  Q_DECLARE_PRIVATE_D(KToggleAction::d, KToggleFullScreenAction)
89 #if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 79)
90  // Unused, kept for ABI compatibility
91  const void *__kwidgetsaddons_d_do_not_use;
92 #endif
93 };
94 
95 #endif
virtual bool eventFilter(QObject *watched, QEvent *event)
Checkbox like action.
Definition: ktoggleaction.h:35
An action for switching between to/from full screen mode.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue May 11 2021 22:44:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.