summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-06-17 00:26:13 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-06-18 02:45:07 (GMT)
commit7b1822dad8091e69a5c0eafb489444d2b7552a5e (patch)
tree528c7871e2e42584b6ca7b82e0fd22d72adbc436
parent46e8e2afc6b351b1024f94f5146814bfe866607e (diff)
downloadQt-7b1822dad8091e69a5c0eafb489444d2b7552a5e.zip
Qt-7b1822dad8091e69a5c0eafb489444d2b7552a5e.tar.gz
Qt-7b1822dad8091e69a5c0eafb489444d2b7552a5e.tar.bz2
clearFocus() shouldn't mess with focus if it doesn't have focus
removing an item from the view caused the focus to change even if the removed item didn't have focus. Task-number: QTBUG-11341 Reviewed-by: Yoann Lopes (cherry picked from commit 7a577ff67388413a882435c5cbd1ad6d1fa8393d)
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 8042c46..c9176d1 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3277,7 +3277,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
*/
void QGraphicsItem::clearFocus()
{
- d_ptr->clearFocusHelper(/* giveFocusToParent = */ true);
+ if (hasFocus())
+ d_ptr->clearFocusHelper(/* giveFocusToParent = */ true);
}
/*!