Libplasma

appletpopup.h
1/*
2 SPDX-FileCopyrightText: 2023 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "popupplasmawindow.h"
10
11#include <QQuickItem>
12
13#include <plasmaquick/plasmaquick_export.h>
14
15namespace PlasmaQuick
16{
17
18class AppletQuickItem;
19class LayoutChangedProxy;
20
21/**
22 * @brief The AppletPopup class shows a popup for an applet either in the panel or on the desktop
23 *
24 * In addition to the new API this class is resizable and can forward any input events recieved
25 * on the margin to the main item
26 *
27 * Size hints are transferred from the mainItem's size hints.
28 */
29class PLASMAQUICK_EXPORT AppletPopup : public PopupPlasmaWindow
30{
31 Q_OBJECT
32 /**
33 * This property holds a pointer to the AppletInterface used by
34 */
35 Q_PROPERTY(QQuickItem *appletInterface READ appletInterface WRITE setAppletInterface NOTIFY appletInterfaceChanged)
36
37 /**
38 * Whether the dialog should be hidden when the dialog loses focus.
39 *
40 * The default value is @c false.
41 **/
42 Q_PROPERTY(bool hideOnWindowDeactivate READ hideOnWindowDeactivate WRITE setHideOnWindowDeactivate NOTIFY hideOnWindowDeactivateChanged)
43
44public:
46 ~AppletPopup() override;
47 QQuickItem *appletInterface() const;
48 void setAppletInterface(QQuickItem *appletInterface);
49
50 bool hideOnWindowDeactivate() const;
51 void setHideOnWindowDeactivate(bool hideOnWindowDeactivate);
52
53Q_SIGNALS:
54 void appletInterfaceChanged();
55 void hideOnWindowDeactivateChanged();
56
57protected:
58 void hideEvent(QHideEvent *event) override;
59 void focusOutEvent(QFocusEvent *event) override;
60
61private:
62 void onMainItemChanged();
63 void updateMinSize();
64 void updateMaxSize();
65 void updateSize();
66
67 QPointer<AppletQuickItem> m_appletInterface;
68 QPointer<QScreen> m_oldScreen;
69 bool m_hideOnWindowDeactivate = false;
70 bool m_sizeExplicitlySetFromConfig = false;
71 QScopedPointer<LayoutChangedProxy> m_layoutChangedProxy;
72};
73
74}
The AppletPopup class shows a popup for an applet either in the panel or on the desktop.
Definition appletpopup.h:30
The PopupPlasmaWindow class is a styled Plasma window that can be positioned relative to an existing ...
The EdgeEventForwarder class This class forwards edge events to be replayed within the given margin T...
Definition action.h:20
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:06:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.