QErrorMessage: Improve standard dialogs example

Change-Id: Ia5a2251662fe56809fc66cdadd117259d6bfd977
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-11-21 13:32:10 +01:00
parent f2415df24d
commit 5789ffd9cc
2 changed files with 7 additions and 9 deletions

View File

@ -138,8 +138,6 @@ Dialog::Dialog(QWidget *parent)
warningLabel->setFrameStyle(frameStyle);
QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));
errorLabel = new QLabel;
errorLabel->setFrameStyle(frameStyle);
QPushButton *errorButton =
new QPushButton(tr("QErrorMessage::showM&essage()"));
@ -249,7 +247,6 @@ Dialog::Dialog(QWidget *parent)
layout->addWidget(warningButton, 3, 0);
layout->addWidget(warningLabel, 3, 1);
layout->addWidget(errorButton, 4, 0);
layout->addWidget(errorLabel, 4, 1);
layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
toolbox->addItem(page, tr("Message Boxes"));
@ -470,11 +467,13 @@ void Dialog::errorMessage()
{
errorMessageDialog->showMessage(
tr("This dialog shows and remembers error messages. "
"If the checkbox is checked (as it is by default), "
"the shown message will be shown again, "
"but if the user unchecks the box the message "
"If the user chooses to not show the dialog again, the dialog "
"will not appear again if QErrorMessage::showMessage() "
"is called with the same message."));
errorLabel->setText(tr("If the box is unchecked, the message "
"won't appear again."));
errorMessageDialog->showMessage(
tr("You can queue up error messages, and they will be "
"shown one after each other. Each message maintains "
"its own state for whether it will be shown again "
"the next time QErrorMessage::showMessage() is called "
"with the same message."));
}

View File

@ -55,7 +55,6 @@ private:
QLabel *informationLabel;
QLabel *questionLabel;
QLabel *warningLabel;
QLabel *errorLabel;
QErrorMessage *errorMessageDialog;
DialogOptionsWidget *fileDialogOptionsWidget;
DialogOptionsWidget *colorDialogOptionsWidget;