int QmlJSDebugger::QDeclarativeViewInspectorPrivate::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: _q_setToolBoxVisible((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 1: _q_reloadView(); break;
        case 2: _q_onStatusChanged((*reinterpret_cast< QDeclarativeView::Status(*)>(_a[1]))); break;
        case 3: _q_onCurrentObjectsChanged((*reinterpret_cast< QList<QObject*>(*)>(_a[1]))); break;
        case 4: _q_applyChangesFromClient(); break;
        case 5: _q_createQmlObject((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< QObject*(*)>(_a[2])),(*reinterpret_cast< const QStringList(*)>(_a[3])),(*reinterpret_cast< const QString(*)>(_a[4])),(*reinterpret_cast< int(*)>(_a[5]))); break;
        case 6: _q_createQmlObject((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< QObject*(*)>(_a[2])),(*reinterpret_cast< const QStringList(*)>(_a[3])),(*reinterpret_cast< const QString(*)>(_a[4]))); break;
        case 7: _q_createQmlObject((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< QObject*(*)>(_a[2])),(*reinterpret_cast< const QStringList(*)>(_a[3]))); break;
        case 8: _q_reparentQmlObject((*reinterpret_cast< QObject*(*)>(_a[1])),(*reinterpret_cast< QObject*(*)>(_a[2]))); break;
        case 9: _q_deleteQmlObject((*reinterpret_cast< QObject*(*)>(_a[1]))); break;
        case 10: _q_changeToSingleSelectTool(); break;
        case 11: _q_changeToMarqueeSelectTool(); break;
        case 12: _q_changeToZoomTool(); break;
        case 13: _q_changeToColorPickerTool(); break;
        case 14: _q_clearComponentCache(); break;
        case 15: _q_removeFromSelection((*reinterpret_cast< QObject*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 16;
    }
    return _id;
}
QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent) :
    QObject(parent), data(new QDeclarativeViewInspectorPrivate(this))
{
    data->view = view;
    data->manipulatorLayer = new LiveLayerItem(view->scene());
    data->selectionTool = new LiveSelectionTool(this);
    data->zoomTool = new ZoomTool(this);
    data->colorPickerTool = new ColorPickerTool(this);
    data->boundingRectHighlighter = new BoundingRectHighlighter(this);
    data->currentTool = data->selectionTool;

    // to capture ChildRemoved event when viewport changes
    data->view->installEventFilter(this);

    data->setViewport(data->view->viewport());

    data->debugService = QDeclarativeInspectorService::instance();

    connect(data->debugService, SIGNAL(designModeBehaviorChanged(bool)),
            SLOT(setDesignModeBehavior(bool)));
    connect(data->debugService, SIGNAL(showAppOnTopChanged(bool)),
            SLOT(setShowAppOnTop(bool)));
    connect(data->debugService, SIGNAL(reloadRequested()), data.data(), SLOT(_q_reloadView()));
    connect(data->debugService, SIGNAL(currentObjectsChanged(QList<QObject*>)),
            data.data(), SLOT(_q_onCurrentObjectsChanged(QList<QObject*>)));
    connect(data->debugService, SIGNAL(animationSpeedChangeRequested(qreal)),
            SLOT(animationSpeedChangeRequested(qreal)));
    connect(data->debugService, SIGNAL(executionPauseChangeRequested(bool)),
            SLOT(animationPausedChangeRequested(bool)));
    connect(data->debugService, SIGNAL(colorPickerToolRequested()),
            data.data(), SLOT(_q_changeToColorPickerTool()));
    connect(data->debugService, SIGNAL(selectMarqueeToolRequested()),
            data.data(), SLOT(_q_changeToMarqueeSelectTool()));
    connect(data->debugService, SIGNAL(selectToolRequested()), data.data(), SLOT(_q_changeToSingleSelectTool()));
    connect(data->debugService, SIGNAL(zoomToolRequested()), data.data(), SLOT(_q_changeToZoomTool()));
    connect(data->debugService,
            SIGNAL(objectCreationRequested(QString,QObject*,QStringList,QString,int)),
            data.data(), SLOT(_q_createQmlObject(QString,QObject*,QStringList,QString,int)));
    connect(data->debugService,
            SIGNAL(objectDeletionRequested(QObject *)), data.data(), SLOT(_q_deleteQmlObject(QObject *)));
    connect(data->debugService,
            SIGNAL(objectReparentRequested(QObject *, QObject *)),
            data.data(), SLOT(_q_reparentQmlObject(QObject *, QObject *)));
    connect(data->debugService, SIGNAL(clearComponentCacheRequested()),
            data.data(), SLOT(_q_clearComponentCache()));
    connect(data->view, SIGNAL(statusChanged(QDeclarativeView::Status)),
            data.data(), SLOT(_q_onStatusChanged(QDeclarativeView::Status)));

    connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
            SIGNAL(selectedColorChanged(QColor)));
    connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
            data->debugService, SLOT(selectedColorChanged(QColor)));

    data->_q_changeToSingleSelectTool();
}