From 5db9309f372b4aec16c2206fccde0c4c3e19fdc2 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 1 Sep 2009 10:43:07 +1000 Subject: Fix FocusPanel. --- src/declarative/fx/qfxfocuspanel.cpp | 19 +++++++------------ src/declarative/fx/qfxfocuspanel.h | 6 +++--- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp index 374f566..3bb0b25 100644 --- a/src/declarative/fx/qfxfocuspanel.cpp +++ b/src/declarative/fx/qfxfocuspanel.cpp @@ -41,6 +41,7 @@ #include "qfxfocuspanel.h" #include +#include QT_BEGIN_NAMESPACE @@ -76,19 +77,13 @@ QFxFocusPanel::~QFxFocusPanel() Sets whether the item is the active focus panel. */ -void QFxFocusPanel::setActive(bool a) -{ - if (!scene()) - return; - - if (isActive() == a) - return; - if (a) - scene()->setActivePanel(this); - else - scene()->setActivePanel(0); - emit activeChanged(); +bool QFxFocusPanel::sceneEvent(QEvent *event) +{ + if (event->type() == QEvent::WindowActivate || + event->type() == QEvent::WindowDeactivate) + emit activeChanged(); + return QFxItem::sceneEvent(event); } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxfocuspanel.h b/src/declarative/fx/qfxfocuspanel.h index ba4c1f5..1fea011 100644 --- a/src/declarative/fx/qfxfocuspanel.h +++ b/src/declarative/fx/qfxfocuspanel.h @@ -58,12 +58,12 @@ public: QFxFocusPanel(QFxItem *parent=0); virtual ~QFxFocusPanel(); - //bool isActive() const; - void setActive(bool); - Q_SIGNALS: void activeChanged(); +protected: + bool sceneEvent(QEvent *event); + private: Q_DISABLE_COPY(QFxFocusPanel) }; -- cgit v0.12