From 5789ffd9ccd67ffaa45f42fe3e96355ad7311eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 21 Nov 2022 13:32:10 +0100 Subject: QErrorMessage: Improve standard dialogs example Change-Id: Ia5a2251662fe56809fc66cdadd117259d6bfd977 Reviewed-by: Richard Moe Gustavsen --- examples/widgets/dialogs/standarddialogs/dialog.cpp | 15 +++++++-------- examples/widgets/dialogs/standarddialogs/dialog.h | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'examples/widgets/dialogs') diff --git a/examples/widgets/dialogs/standarddialogs/dialog.cpp b/examples/widgets/dialogs/standarddialogs/dialog.cpp index 9f1cc96528..af8df344c7 100644 --- a/examples/widgets/dialogs/standarddialogs/dialog.cpp +++ b/examples/widgets/dialogs/standarddialogs/dialog.cpp @@ -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.")); } diff --git a/examples/widgets/dialogs/standarddialogs/dialog.h b/examples/widgets/dialogs/standarddialogs/dialog.h index b316caf529..88d0f7519f 100644 --- a/examples/widgets/dialogs/standarddialogs/dialog.h +++ b/examples/widgets/dialogs/standarddialogs/dialog.h @@ -55,7 +55,6 @@ private: QLabel *informationLabel; QLabel *questionLabel; QLabel *warningLabel; - QLabel *errorLabel; QErrorMessage *errorMessageDialog; DialogOptionsWidget *fileDialogOptionsWidget; DialogOptionsWidget *colorDialogOptionsWidget; -- cgit v1.2.3