diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-10-08 13:31:19 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-15 06:20:25 +0100 |
commit | 9a6b005b53c7ee0f55230be5d1f21d8cc0eeb51d (patch) | |
tree | fc1b4d99040179e20f16871f0ff9841ca4bc86dd /src/gui/dialogs/qwizard.cpp | |
parent | 9afc8096fb5395216cd5813fb1859ff45b087d92 (diff) | |
download | qt4-tools-9a6b005b53c7ee0f55230be5d1f21d8cc0eeb51d.tar.gz |
QWizard: give all buttons an objectName
Only Commit, Finish and Cancel didn't have an object name, yet.
Also Extract Method on the switch statement, add a test, and
use QStringBuilder.
Task-number: QTBUG-29924
Reported-by: Leo Arias
Change-Id: I8c29606bc53e9d4caab631da2089e971a9da2d75
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
(cherry picked from qtbase/1ea191276ea49ce2334d21b1f4a2c66ee8889466)
Diffstat (limited to 'src/gui/dialogs/qwizard.cpp')
-rw-r--r-- | src/gui/dialogs/qwizard.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index fbc7a7922c..20c9edc531 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -1350,6 +1350,21 @@ void QWizardPrivate::updateCurrentPage() updateButtonTexts(); } +static QString object_name_for_button(QWizard::WizardButton which) +{ + switch (which) { + case QWizard::CommitButton: + return QLatin1String("qt_wizard_") + QLatin1String("commit"); + case QWizard::FinishButton: + return QLatin1String("qt_wizard_") + QLatin1String("finish"); + case QWizard::CancelButton: + return QLatin1String("qt_wizard_") + QLatin1String("cancel"); + default: + // Make navigation buttons detectable as passive interactor in designer + return QLatin1String("__qt__passive_wizardbutton") + QString::number(which); + } +} + bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const { Q_Q(const QWizard); @@ -1361,19 +1376,7 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const QStyle *style = q->style(); if (style != QApplication::style()) // Propagate style pushButton->setStyle(style); - // Make navigation buttons detectable as passive interactor in designer - switch (which) { - case QWizard::CommitButton: - case QWizard::FinishButton: - case QWizard::CancelButton: - break; - default: { - QString objectName = QLatin1String("__qt__passive_wizardbutton"); - objectName += QString::number(which); - pushButton->setObjectName(objectName); - } - break; - } + pushButton->setObjectName(object_name_for_button(which)); #ifdef Q_WS_MAC pushButton->setAutoDefault(false); #endif |