diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-01-19 15:52:22 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-01-20 16:33:45 (GMT) |
commit | e7b0998325a66ecb9f979f253d732db85e1f43d1 (patch) | |
tree | 7c515404a911b7b24dedb1898cc6d2c03c1a9af6 | |
parent | 1315a7e85c45e94c74c1ae7d92b331c21bfe79f7 (diff) | |
download | Qt-e7b0998325a66ecb9f979f253d732db85e1f43d1.zip Qt-e7b0998325a66ecb9f979f253d732db85e1f43d1.tar.gz Qt-e7b0998325a66ecb9f979f253d732db85e1f43d1.tar.bz2 |
QGraphicsItem::hasFocus() performance regression.
Problem was that we always climbed the parent chain to look for a panel
item (QGraphicsItem::isActive()) before checking the scene's focus item.
Task-number: QTBUG-6749
Reviewed-by: alexis
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index cae9660..1361a89 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2997,9 +2997,16 @@ void QGraphicsItem::setActive(bool active) */ bool QGraphicsItem::hasFocus() const { + if (!d_ptr->scene || !d_ptr->scene->isActive()) + return false; + if (d_ptr->focusProxy) return d_ptr->focusProxy->hasFocus(); - return isActive() && (d_ptr->scene && d_ptr->scene->focusItem() == this); + + if (d_ptr->scene->d_func()->focusItem != this) + return false; + + return panel() == d_ptr->scene->d_func()->activePanel; } /*! |