aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates/qquickpopupwindow_p_p.h
blob: 5c7908a159ef11f9892fe60ba2b934e595441457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default

#ifndef QQUICKPOPUPWINDOW_P_P_H
#define QQUICKPOPUPWINDOW_P_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtQuick/private/qquickwindowmodule_p.h>
#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>

QT_BEGIN_NAMESPACE

class QQuickPopup;
class QQuickPopupWindowPrivate;

class Q_QUICKTEMPLATES2_EXPORT QQuickPopupWindow : public QQuickWindowQmlImpl
{
    Q_OBJECT
    QML_ANONYMOUS

public:
    explicit QQuickPopupWindow(QQuickPopup *popup, QWindow *parent = nullptr);
    QQuickPopup *popup() const;

protected:
    void hideEvent(QHideEvent *e) override;
    void moveEvent(QMoveEvent *e) override;
    void resizeEvent(QResizeEvent *e) override;
    bool event(QEvent *e) override;

private:
    void windowChanged(QWindow *window);
    std::optional<QPoint> global2Local(const QPoint &pos) const;
    void parentWindowXChanged(int newX);
    void parentWindowYChanged(int newY);
    void handlePopupPositionChangeFromWindowSystem(const QPoint &pos);
    void implicitWidthChanged();
    void implicitHeightChanged();

    Q_DISABLE_COPY(QQuickPopupWindow)
    Q_DECLARE_PRIVATE(QQuickPopupWindow)
};

QT_END_NAMESPACE

#endif // QQUICKPOPUPWINDOW_P_P_H