diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-12-12 22:40:30 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-21 19:03:12 +0200 |
commit | bab630e4bf0a9a651a7e15d0d15f9c0f57ab5e46 (patch) | |
tree | df73c73463f2665ab1d0b510c8d500a384cd1eb8 /src/widgets/widgets | |
parent | 7ddf1b14ecc7e56ddcc78cc7057881d7925d20ff (diff) |
QDialogButtonBox: add a missing constructor
Setting the buttons in the constructor is a use-case that happens
more often than setting the orientation. Yet, there was a
(Qt::Orientation,QWidget*) constructor, but no
(StandardButtons,QWidget*) one.
This patch adds it.
Change-Id: If6a5c9f7450a388cd77bd93c8dd144b2fdc11847
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: David Faure (KDE) <faure@kde.org>
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qdialogbuttonbox.cpp | 15 | ||||
-rw-r--r-- | src/widgets/widgets/qdialogbuttonbox.h | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index bc5d84e259..226969cdd1 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -669,6 +669,21 @@ QDialogButtonBox::QDialogButtonBox(Qt::Orientation orientation, QWidget *parent) } /*! + \since 5.2 + + Constructs a horizontal button box with the given \a parent, containing + the standard buttons specified by \a buttons. + + \sa orientation, addButton() +*/ +QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent) + : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0) +{ + d_func()->initLayout(); + d_func()->createStandardButtons(buttons); +} + +/*! Constructs a button box with the given \a orientation and \a parent, containing the standard buttons specified by \a buttons. diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h index 6715c590e2..d8e1a997d4 100644 --- a/src/widgets/widgets/qdialogbuttonbox.h +++ b/src/widgets/widgets/qdialogbuttonbox.h @@ -115,7 +115,8 @@ public: QDialogButtonBox(QWidget *parent = 0); QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = 0); - QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation = Qt::Horizontal, + explicit QDialogButtonBox(StandardButtons buttons, QWidget *parent = 0); + QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation, QWidget *parent = 0); ~QDialogButtonBox(); |