This repository was archived by the owner on Feb 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomquickwindow.h
81 lines (68 loc) · 2.12 KB
/
customquickwindow.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//-------------------------------------------------------
//
// SPDX-License-Identifier: LGPLv2
//
// Copyright © 2024 Noah Felber
//
// All Rights Reserved/Alle Rechte vorbehalten.
//
//-------------------------------------------------------
#pragma once
#include <QQuickWindow>
#include <QMouseEvent>
#include <QCursor>
class CustomQQuickWindowPriv;
/*!
* \brief The CustomQQuickWindow class
*
* Provides a superset which is also a downgrade of the original QQuickWindow,
* with the support for a system drawn backdrop, a custom Title bar and global dragging
*/
class CustomQQuickWindow : public QQuickWindow {
Q_OBJECT
QML_ELEMENT
public:
CustomQQuickWindow(QWindow* parent = nullptr);
/*!
* \brief Enable or disable global window dragging
* \param enable: wether the global dragging should be enabled
*/
Q_INVOKABLE const void setGlobalDrag(const bool enable = false);
/*!
* \brief Get if the global dragging is enabled
* \return bool: global dragging enabled
*/
Q_INVOKABLE const bool globalDrag();
/*!
* \brief Sets the width of the area at the edge of the window where resizing is activated
* \param margin: The width
*/
Q_INVOKABLE const void setResizeMargin(const int margin = 10);
/*!
* \brief retrieve the width of the resize margin
* \return int: The margin
*/
Q_INVOKABLE const int resizeMargin();
/*!
* \brief Sets the titleBar height
* \param height: The height
*
* This is the area at the Top where you can move the window whon global draggin is disabled.
* It also displays the window title and Buttons
*/
Q_INVOKABLE const void setTitleBarHeight(const int height = 30);
/*!
* \brief retrieve the current titlebar height
* \return int: the current titlebar height
*/
Q_INVOKABLE const int titleBarHeight();
/*!
* \brief Call before loading your QML Engine
* Resgisters the component
*/
static const void registerQmlType();
signals:
void resized(const QRect& newSize);
private:
CustomQQuickWindowPriv* _p;
};