diff options
author | Yulong Bai <yulong.bai@qt.io> | 2017-10-17 14:41:42 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-10-24 16:43:30 +0000 |
commit | 7e7683cabb8df58097c5bc4638a2e08cf6e6ff71 (patch) | |
tree | ec07937eae526476e1cfb6c76b298b7f0e155b7c /src/widgets/kernel/qaction.cpp | |
parent | 7944423bfaec48e5c7642a042bede1557b1beff2 (diff) |
QAction: fix ::setData() always emits changed()
QAction::setData() always emits changed() even without actual data change.
Original code lacks a guard to check if the data changes.
According to http://doc.qt.io/qt-4.8/signalsandslots.html,
adding guard also benefits to prevent infinite looping in case
of cyclic connections.
Task-number: QTBUG-62006
Change-Id: I776369b668082f9f02e4502a36b1ae234ee7e079
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/kernel/qaction.cpp')
-rw-r--r-- | src/widgets/kernel/qaction.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index f1788bb3f4..7754defaac 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -1118,6 +1118,8 @@ void QAction::setData(const QVariant &data) { Q_D(QAction); + if (d->userData == data) + return; d->userData = data; d->sendDataChanged(); } |