Rename QMessageDialogOptions::Icon to StandardIcon
To clarify its use as a pre-defined standard icon, which is a separate use-case from providing a user-defined QIcon. Change-Id: I187ce2e5f125a7392b1279c9bd1e871790c8065f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
24e4fb34cd
commit
53b413f1c5
@ -59,15 +59,15 @@ public class QtMessageDialogHelper
|
||||
}
|
||||
|
||||
|
||||
public void setIcon(int icon)
|
||||
public void setStandardIcon(int icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
m_standardIcon = icon;
|
||||
|
||||
}
|
||||
|
||||
private Drawable getIconDrawable()
|
||||
{
|
||||
if (m_icon == 0)
|
||||
if (m_standardIcon == 0)
|
||||
return null;
|
||||
|
||||
try {
|
||||
@ -79,7 +79,7 @@ public class QtMessageDialogHelper
|
||||
}
|
||||
|
||||
// Information, Warning, Critical, Question
|
||||
switch (m_icon)
|
||||
switch (m_standardIcon)
|
||||
{
|
||||
case 1: // Information
|
||||
try {
|
||||
@ -332,7 +332,7 @@ public class QtMessageDialogHelper
|
||||
|
||||
public void reset()
|
||||
{
|
||||
m_icon = 0;
|
||||
m_standardIcon = 0;
|
||||
m_title = null;
|
||||
m_text = null;
|
||||
m_informativeText = null;
|
||||
@ -343,7 +343,7 @@ public class QtMessageDialogHelper
|
||||
}
|
||||
|
||||
private Activity m_activity;
|
||||
private int m_icon = 0;
|
||||
private int m_standardIcon = 0;
|
||||
private Spanned m_title, m_text, m_informativeText, m_detailedText;
|
||||
private ArrayList<ButtonStruct> m_buttonsList;
|
||||
private AlertDialog m_dialog;
|
||||
|
@ -768,7 +768,7 @@ public:
|
||||
{}
|
||||
|
||||
QString windowTitle;
|
||||
QMessageDialogOptions::Icon icon;
|
||||
QMessageDialogOptions::StandardIcon icon;
|
||||
QString text;
|
||||
QString informativeText;
|
||||
QString detailedText;
|
||||
@ -818,12 +818,12 @@ void QMessageDialogOptions::setWindowTitle(const QString &title)
|
||||
d->windowTitle = title;
|
||||
}
|
||||
|
||||
QMessageDialogOptions::Icon QMessageDialogOptions::icon() const
|
||||
QMessageDialogOptions::StandardIcon QMessageDialogOptions::standardIcon() const
|
||||
{
|
||||
return d->icon;
|
||||
}
|
||||
|
||||
void QMessageDialogOptions::setIcon(Icon icon)
|
||||
void QMessageDialogOptions::setStandardIcon(StandardIcon icon)
|
||||
{
|
||||
d->icon = icon;
|
||||
}
|
||||
|
@ -404,8 +404,8 @@ protected:
|
||||
|
||||
public:
|
||||
// Keep in sync with QMessageBox::Icon
|
||||
enum Icon { NoIcon, Information, Warning, Critical, Question };
|
||||
Q_ENUM(Icon)
|
||||
enum StandardIcon { NoIcon, Information, Warning, Critical, Question };
|
||||
Q_ENUM(StandardIcon)
|
||||
|
||||
static QSharedPointer<QMessageDialogOptions> create();
|
||||
QSharedPointer<QMessageDialogOptions> clone() const;
|
||||
@ -413,8 +413,8 @@ public:
|
||||
QString windowTitle() const;
|
||||
void setWindowTitle(const QString &);
|
||||
|
||||
void setIcon(Icon icon);
|
||||
Icon icon() const;
|
||||
void setStandardIcon(StandardIcon icon);
|
||||
StandardIcon standardIcon() const;
|
||||
|
||||
void setIconPixmap(const QPixmap &pixmap);
|
||||
QPixmap iconPixmap() const;
|
||||
|
@ -57,7 +57,7 @@ bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags,
|
||||
if (opt->supressionCheckBoxEnabled())
|
||||
return false; // Can't support
|
||||
|
||||
m_javaMessageDialog.callMethod<void>("setIcon", "(I)V", opt->icon());
|
||||
m_javaMessageDialog.callMethod<void>("standardIcon", "(I)V", opt->standardIcon());
|
||||
|
||||
QString str = htmlText(opt->windowTitle());
|
||||
if (!str.isEmpty()) {
|
||||
|
@ -91,7 +91,7 @@ bool QCocoaMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality w
|
||||
m_alert.messageText = text.toNSString();
|
||||
m_alert.informativeText = toPlainText(options()->informativeText()).toNSString();
|
||||
|
||||
switch (auto standardIcon = options()->icon()) {
|
||||
switch (options()->standardIcon()) {
|
||||
case QMessageDialogOptions::NoIcon: {
|
||||
// We only reflect the pixmap icon if the standard icon is unset,
|
||||
// as setting a standard icon will also set a corresponding pixmap
|
||||
|
@ -85,7 +85,7 @@ void QErrorMessagePrivate::helperPrepareShow(QPlatformDialogHelper *helper)
|
||||
options->setWindowTitle(q->windowTitle());
|
||||
options->setText(QErrorMessage::tr("An error occurred"));
|
||||
options->setInformativeText(currentMessage);
|
||||
options->setIcon(QMessageDialogOptions::Critical);
|
||||
options->setStandardIcon(QMessageDialogOptions::Critical);
|
||||
options->setSupressionCheckBoxEnabled(true);
|
||||
messageDialogHelper->setOptions(options);
|
||||
}
|
||||
|
@ -2683,7 +2683,7 @@ void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)
|
||||
static_cast<QPlatformMessageDialogHelper *>(h)->setOptions(options);
|
||||
}
|
||||
|
||||
static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i)
|
||||
static QMessageDialogOptions::StandardIcon helperIcon(QMessageBox::Icon i)
|
||||
{
|
||||
switch (i) {
|
||||
case QMessageBox::NoIcon:
|
||||
@ -2715,7 +2715,7 @@ void QMessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper *)
|
||||
#if QT_CONFIG(textedit)
|
||||
options->setDetailedText(q->detailedText());
|
||||
#endif
|
||||
options->setIcon(helperIcon(q->icon()));
|
||||
options->setStandardIcon(helperIcon(q->icon()));
|
||||
options->setIconPixmap(q->iconPixmap());
|
||||
options->setStandardButtons(helperStandardButtons(q));
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
|
||||
|
||||
public:
|
||||
enum Icon {
|
||||
// keep this in sync with QMessageDialogOptions::Icon
|
||||
// keep this in sync with QMessageDialogOptions::StandardIcon
|
||||
NoIcon = 0,
|
||||
Information = 1,
|
||||
Warning = 2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user