KWidgetsAddons

ktogglefullscreenaction.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <reggie@kde.org>
4  SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org>
5  SPDX-FileCopyrightText: 2000 Nicolas Hadacek <haadcek@kde.org>
6  SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org>
7  SPDX-FileCopyrightText: 2000 Michael Koch <koch@kde.org>
8  SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org>
9  SPDX-FileCopyrightText: 2002 Ellis Whitehead <ellis@kde.org>
10  SPDX-FileCopyrightText: 2003 Andras Mantia <amantia@kde.org>
11  SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <rodda@kde.org>
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  // KF6 TODO: remove
85 protected Q_SLOTS:
86  void slotToggled(bool checked) override;
87 
88 private:
89  Q_DECLARE_PRIVATE(KToggleFullScreenAction)
90 };
91 
92 #endif
Q_SLOTSQ_SLOTS
virtual bool eventFilter(QObject *watched, QEvent *event)
Checkbox like action.
Definition: ktoggleaction.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 04:01:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.