Commit 2b8e5b53 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlObserver: Fix navigation on Mac OS X

The QmlObserver relies on installing an event handler on the graphicsview
viewport, to get e.g. Mouse events.

QmlObserver on Mac OS X switches the viewport later on to a QGLViewPort, when
QmlObserver has already been set up ... Make QmlObserver aware of this by
listening to the ChildRemoved event that will be signalled in this case.

Task-number: QTCREATORBUG-2892
Reviewed-by: Lasse Holmstedt
parent 3564feac
......@@ -79,8 +79,10 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje
data->subcomponentEditorTool = new SubcomponentEditorTool(this);
data->currentTool = data->selectionTool;
// to capture ChildRemoved event when viewport changes
data->debugService = QDeclarativeObserverService::instance();
connect(data->debugService, SIGNAL(designModeBehaviorChanged(bool)), SLOT(setDesignModeBehavior(bool)));
......@@ -137,6 +139,22 @@ void QDeclarativeViewObserverPrivate::_q_reloadView()
emit q->reloadRequested();
void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget)
if ( == widget)
if (viewport) {
viewport = widget;
if (viewport) {
// make sure we get mouse move events
void QDeclarativeViewObserverPrivate::clearEditorItems()
......@@ -145,6 +163,17 @@ void QDeclarativeViewObserverPrivate::clearEditorItems()
bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event)
if (obj == data->view) {
// Event from view
if (event->type() == QEvent::ChildRemoved) {
// Might mean that viewport has changed
if (data->view->viewport() != data->
return QObject::eventFilter(obj, event);
//Event from viewport
switch (event->type()) {
case QEvent::Leave: {
if (leaveEvent(event))
......@@ -66,6 +66,7 @@ public:
QDeclarativeView *view;
QDeclarativeViewObserver *q;
QDeclarativeObserverService *debugService;
QWeakPointer<QWidget> viewport;
QPointF cursorPos;
QList<QWeakPointer<QGraphicsObject> > currentSelection;
......@@ -88,6 +89,8 @@ public:
QmlToolbar *toolbar;
void setViewport(QWidget *widget);
void clearEditorItems();
void createToolbar();
void changeToSelectTool();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment