Connect all connections to action in QMenuItem::setAction

Summary:
Otherwise if anyone used setAction it would be missing a very important
connect.

Test Plan: Compiled

Reviewers: #plasma

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4758
This commit is contained in:
David Edmundson 2017-02-24 13:20:21 +00:00
parent 1934475e48
commit 07d8df77a1

View File

@ -26,7 +26,6 @@ QMenuItem::QMenuItem(QQuickItem *parent)
m_section(false)
{
setAction(new QAction(this));
connect(m_action, &QAction::triggered, this, &QMenuItem::clicked);
}
QAction *QMenuItem::action() const
@ -44,6 +43,7 @@ void QMenuItem::setAction(QAction *a)
connect(m_action, &QAction::changed, this, &QMenuItem::textChanged);
connect(m_action, &QAction::changed, this, &QMenuItem::checkableChanged);
connect(m_action, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
connect(m_action, &QAction::triggered, this, &QMenuItem::clicked);
connect(this, &QQuickItem::visibleChanged, this, &QMenuItem::updateAction);
connect(this, &QQuickItem::enabledChanged, this, &QMenuItem::updateAction);