From 7e7683cabb8df58097c5bc4638a2e08cf6e6ff71 Mon Sep 17 00:00:00 2001 From: Yulong Bai Date: Tue, 17 Oct 2017 14:41:42 +0200 Subject: 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 --- src/widgets/kernel/qaction.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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(); } -- cgit v1.2.3