Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickmessagedialog.cpp
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
5
7
12
104
113{
114 return m_options->text();
115}
116
118{
119 if (m_options->text() == text)
120 return;
121
122 m_options->setText(text);
123
125}
126
137{
138 return m_options->informativeText();
139}
140
142{
143 if (m_options->informativeText() == text)
144 return;
145
146 m_options->setInformativeText(text);
147
149}
150
159{
160 return m_options->detailedText();
161}
162
164{
165 if (m_options->detailedText() == text)
166 return;
167
168 m_options->setDetailedText(text);
169
171}
172
203QPlatformDialogHelper::StandardButtons QQuickMessageDialog::buttons() const
204{
205 return m_options->standardButtons();
206}
207
208void QQuickMessageDialog::setButtons(QPlatformDialogHelper::StandardButtons buttons)
209{
210 if (m_options->standardButtons() == buttons)
211 return;
212
213 m_options->setStandardButtons(buttons);
214
216}
217
218void QQuickMessageDialog::handleClick(QPlatformDialogHelper::StandardButton button,
220{
221 m_roleOfLastButtonPressed = role;
223 done(button);
224}
225
227{
228 if (QPlatformMessageDialogHelper *messageDialog =
229 qobject_cast<QPlatformMessageDialogHelper *>(dialog)) {
231 &QQuickMessageDialog::handleClick);
232 messageDialog->setOptions(m_options);
233 }
234}
235
237{
238 m_options->setWindowTitle(title());
239
240 if (QPlatformMessageDialogHelper *messageDialog =
241 qobject_cast<QPlatformMessageDialogHelper *>(dialog))
242 messageDialog->setOptions(m_options); // setOptions only assigns a member and isn't virtual
243}
244
246{
247 switch (m_roleOfLastButtonPressed) {
250 return Accepted;
253 return Rejected;
254 default:
256 }
257}
258
260
261#include "moc_qquickmessagedialog_p.cpp"
void setWindowTitle(const QString &)
void setInformativeText(const QString &text)
void setDetailedText(const QString &text)
void setText(const QString &text)
void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons)
QPlatformDialogHelper::StandardButtons standardButtons() const
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
The QPlatformMessageDialogHelper class allows for platform-specific customization of Message dialogs.
void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
virtual int dialogCode() const
void setButtons(QPlatformDialogHelper::StandardButtons buttons)
void setDetailedText(const QString &text)
QPlatformDialogHelper::StandardButtons buttons
QQuickMessageDialog(QObject *parent=nullptr)
A message dialog.
void onShow(QPlatformDialogHelper *dialog) override
void setInformativeText(const QString &text)
void informativeTextChanged()
void buttonClicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
void setText(const QString &text)
void onCreate(QPlatformDialogHelper *dialog) override
int dialogCode() const override
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString text
QPushButton * button
[2]
Combined button and popup list for selecting options.
SharedPointerFileDialogOptions m_options
QQuickDialogType
#define emit
QFileDialog dialog(this)
[1]
view create()