1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKMESSAGEDIALOGIMPL_P_H
5#define QQUICKMESSAGEDIALOGIMPL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTemplates2/private/qquickdialog_p.h>
19#include <QtQuickTemplates2/private/qquicklabel_p.h>
20#include <QtQuickTemplates2/private/qquickdialogbuttonbox_p.h>
21#include <QtQuickTemplates2/private/qquicktextarea_p.h>
22#include <QtQuickTemplates2/private/qquickbutton_p.h>
23
24#include "qtquickdialogs2quickimplglobal_p.h"
25
26QT_BEGIN_NAMESPACE
27
28class QQuickMessageDialogImplAttached;
29class QQuickMessageDialogImplAttachedPrivate;
30class QQuickMessageDialogImplPrivate;
31
32class Q_QUICKDIALOGS2QUICKIMPL_PRIVATE_EXPORT QQuickMessageDialogImpl : public QQuickDialog
33{
34 Q_OBJECT
35 Q_PROPERTY(QString text READ text NOTIFY optionsChanged)
36 Q_PROPERTY(QString informativeText READ informativeText NOTIFY optionsChanged)
37 Q_PROPERTY(QString detailedText READ detailedText NOTIFY optionsChanged)
38 Q_PROPERTY(bool showDetailedText READ showDetailedText NOTIFY showDetailedTextChanged)
39 QML_NAMED_ELEMENT(MessageDialogImpl)
40 QML_ATTACHED(QQuickMessageDialogImplAttached)
41 QML_ADDED_IN_VERSION(6, 3)
42public:
43 explicit QQuickMessageDialogImpl(QObject *parent = nullptr);
44
45 static QQuickMessageDialogImplAttached *qmlAttachedProperties(QObject *object);
46
47 QSharedPointer<QMessageDialogOptions> options() const;
48 void setOptions(const QSharedPointer<QMessageDialogOptions> &options);
49
50 bool showDetailedText() const;
51 QString text() const;
52 QString informativeText() const;
53 QString detailedText() const;
54
55Q_SIGNALS:
56 void buttonClicked(QPlatformDialogHelper::StandardButton button,
57 QPlatformDialogHelper::ButtonRole role);
58 void showDetailedTextChanged();
59 void optionsChanged();
60
61public Q_SLOTS:
62 void toggleShowDetailedText();
63
64private:
65 Q_DISABLE_COPY(QQuickMessageDialogImpl)
66 Q_DECLARE_PRIVATE(QQuickMessageDialogImpl)
67};
68
69class Q_QUICKDIALOGS2QUICKIMPL_PRIVATE_EXPORT QQuickMessageDialogImplAttached : public QObject
70{
71 Q_OBJECT
72 Q_PROPERTY(QQuickDialogButtonBox *buttonBox READ buttonBox WRITE setButtonBox NOTIFY
73 buttonBoxChanged)
74 Q_PROPERTY(QQuickButton *detailedTextButton READ detailedTextButton WRITE setDetailedTextButton
75 NOTIFY detailedTextButtonChanged)
76public:
77 explicit QQuickMessageDialogImplAttached(QObject *parent = nullptr);
78
79 QQuickDialogButtonBox *buttonBox() const;
80 void setButtonBox(QQuickDialogButtonBox *buttons);
81
82 QQuickButton *detailedTextButton() const;
83 void setDetailedTextButton(QQuickButton *detailedTextButton);
84
85Q_SIGNALS:
86 void buttonBoxChanged();
87 void detailedTextButtonChanged();
88
89private:
90 Q_DISABLE_COPY(QQuickMessageDialogImplAttached)
91 Q_DECLARE_PRIVATE(QQuickMessageDialogImplAttached)
92};
93
94QT_END_NAMESPACE
95
96QML_DECLARE_TYPE(QQuickMessageDialogImpl)
97
98#endif // QQUICKMESSAGEDIALOGIMPL_P_H
99

source code of qtdeclarative/src/quickdialogs/quickdialogsquickimpl/qquickmessagedialogimpl_p.h