Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
DialogView.h
1/*
2 * DialogView.h
3 * This file is part of Open-Typer
4 *
5 * Copyright (C) 2023 - adazem009
6 *
7 * Open-Typer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * Open-Typer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Open-Typer. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef DIALOGVIEW_H
22#define DIALOGVIEW_H
23
24#include <QQuickItem>
25#include "internal/QuickWindow.h"
26
28class DialogView : public QObject
29{
30 Q_OBJECT
31 Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged)
32 Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
33 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
34 Q_PROPERTY(bool modal READ modal WRITE setModal NOTIFY modalChanged)
35 Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged)
36 Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged)
37 Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
38 Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
39 Q_PROPERTY(bool autoClose READ autoClose WRITE setAutoClose NOTIFY autoCloseChanged)
40 Q_PROPERTY(bool closable READ closable WRITE setClosable NOTIFY closableChanged)
41 Q_PROPERTY(QQuickItem *activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged)
42 public:
43 explicit DialogView(QObject *parent = nullptr);
44
45 QQuickItem *contentItem() const;
46 void setContentItem(QQuickItem *newContentItem);
47
48 bool visible() const;
49 void setVisible(bool newVisible);
50
51 QString title() const;
52 void setTitle(const QString &newTitle);
53
54 bool modal() const;
55 void setModal(bool newModal);
56
57 int minimumWidth() const;
58 void setMinimumWidth(int newMinimumWidth);
59
60 int minimumHeight() const;
61 void setMinimumHeight(int newMinimumHeight);
62
63 int maximumWidth() const;
64 void setMaximumWidth(int newMaximumWidth);
65
66 int maximumHeight() const;
67 void setMaximumHeight(int newMaximumHeight);
68
69 Q_INVOKABLE void setMaximizedState();
70 Q_INVOKABLE void setNormalState();
71 Q_INVOKABLE void showMaximized();
72 Q_INVOKABLE void showNormal();
73
74 bool autoClose() const;
75 void setAutoClose(bool newAutoClose);
76
77 bool closable() const;
78 void setClosable(bool newClosable);
79
80 QQuickItem *activeFocusItem() const;
81
82 signals:
83 void contentItemChanged();
84 void visibleChanged();
85 void titleChanged();
86 void modalChanged();
87 void minimumWidthChanged();
88 void minimumHeightChanged();
89 void maximumWidthChanged();
90 void maximumHeightChanged();
91 void autoCloseChanged();
92 void closableChanged();
93 void activeFocusItemChanged();
94
95 private:
96 QuickWindow m_window;
97 QQuickItem *m_contentItem;
98 bool m_modal = true;
99};
100
101#endif // DIALOGVIEW_H
The DialogView class is a native dialog for QML.
Definition DialogView.h:29
Q_INVOKABLE void setNormalState()
Definition DialogView.cpp:151
Q_INVOKABLE void setMaximizedState()
Definition DialogView.cpp:145
Q_INVOKABLE void showNormal()
Definition DialogView.cpp:163
Q_INVOKABLE void showMaximized()
Definition DialogView.cpp:157
Definition QuickWindow.h:29