diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-04-29 15:12:22 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-05-02 07:56:25 +0000 |
commit | f40dbe0d0b54ce83d2168e82905cf4f75059a841 (patch) | |
tree | 405640220011f4ac0d0222b48bcf92ef1480af54 /src/widgets/kernel/qaction.cpp | |
parent | 799be4e48912170a0441de6dadcbc64aeb7baffa (diff) |
QtWidgets: Introduce delegating constructors.
Reduce code duplication by chaining constructors.
Change-Id: I0229556a417153063ac6d14d35765c85e6fe1fe8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/kernel/qaction.cpp')
-rw-r--r-- | src/widgets/kernel/qaction.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 718ecffcc9..88b29e9147 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -279,12 +279,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) group the action will be automatically inserted into the group. */ QAction::QAction(QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(*new QActionPrivate, parent) { - Q_D(QAction); - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } @@ -302,13 +298,10 @@ QAction::QAction(QObject* parent) */ QAction::QAction(const QString &text, QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(parent) { Q_D(QAction); d->text = text; - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } /*! @@ -324,14 +317,10 @@ QAction::QAction(const QString &text, QObject* parent) setToolTip(). */ QAction::QAction(const QIcon &icon, const QString &text, QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(text, parent) { Q_D(QAction); d->icon = icon; - d->text = text; - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } /*! |