Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickmessagedialog_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKMESSAGEDIALOG_P_H
6#define QQUICKMESSAGEDIALOG_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
20
21#include <QtQuick/private/qquicktext_p.h>
22
23#include <optional>
24
26
27class Q_QUICKDIALOGS2_EXPORT QQuickMessageDialog : public QQuickAbstractDialog
28{
29 Q_OBJECT
30
31private:
32 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
33 Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged FINAL)
34 Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText NOTIFY detailedTextChanged FINAL)
35 Q_PROPERTY(QPlatformDialogHelper::StandardButtons buttons READ buttons WRITE setButtons NOTIFY buttonsChanged FINAL)
36 Q_PROPERTY(QQuickText::TextFormat textFormat READ textFormat WRITE setTextFormat RESET resetTextFormat NOTIFY textFormatChanged REVISION(6, 13))
37 QML_EXTENDED_NAMESPACE(QPlatformDialogHelper)
38 QML_NAMED_ELEMENT(MessageDialog)
39 QML_ADDED_IN_VERSION(6, 3)
40
41public:
42 explicit QQuickMessageDialog(QObject *parent = nullptr);
43
44 QString text() const;
45 void setText(const QString &text);
46
47 QString informativeText() const;
48 void setInformativeText(const QString &text);
49
50 QString detailedText() const;
51 void setDetailedText(const QString &text);
52
53 QPlatformDialogHelper::StandardButtons buttons() const;
54 void setButtons(QPlatformDialogHelper::StandardButtons buttons);
55
56 QQuickText::TextFormat textFormat() const;
57 void setTextFormat(QQuickText::TextFormat textFormat);
58 void resetTextFormat();
59
60Q_SIGNALS:
61 void textChanged();
62 void informativeTextChanged();
63 void detailedTextChanged();
64 void buttonsChanged();
65 Q_REVISION(6, 13) void textFormatChanged();
66
67 void buttonClicked(QPlatformDialogHelper::StandardButton button,
68 QPlatformDialogHelper::ButtonRole role);
69
70private Q_SLOTS:
71 void handleClick(QPlatformDialogHelper::StandardButton button,
72 QPlatformDialogHelper::ButtonRole role);
73
74protected:
75 void onCreate(QPlatformDialogHelper *dialog) override;
76 void onShow(QPlatformDialogHelper *dialog) override;
77 int dialogCode() const override;
78
79private:
80 QSharedPointer<QMessageDialogOptions> m_options;
81 QPlatformDialogHelper::ButtonRole m_roleOfLastButtonPressed = QPlatformDialogHelper::NoRole;
82 std::optional<QQuickText::TextFormat> m_textFormat;
83 bool m_textFormatWarningDisplayed = false;
84};
85
86QT_END_NAMESPACE
87
88#endif // QQUICKMESSAGEDIALOG_P_H
Combined button and popup list for selecting options.