diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp index 2da31293e13f87082ffadf68843ae75f496d7c6c..22ae3d6da0989b638475205c42c8f8d49fb4ae10 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp @@ -70,6 +70,7 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie executionPaused(false), slowdownFactor(1.0f), toolBar(0), + toolBox(0), settings(0) { } @@ -105,6 +106,10 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje data->setViewport(data->view->viewport()); data->debugService = QDeclarativeObserverService::instance(); + + connect(data->debugService, SIGNAL(debuggingClientChanged(bool)), + data.data(), SLOT(_q_setToolBoxVisible(bool))); + connect(data->debugService, SIGNAL(designModeBehaviorChanged(bool)), SLOT(setDesignModeBehavior(bool))); connect(data->debugService, SIGNAL(showAppOnTopChanged(bool)), @@ -146,10 +151,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)), data->debugService, SLOT(contextPathUpdated(QStringList))); -#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) - data->createToolBox(); -#endif - data->_q_changeToSingleSelectTool(); } @@ -166,6 +167,16 @@ void QDeclarativeViewObserver::setObserverContext(int contextIndex) } } +void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) +{ +#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) + if (!toolBox && visible) + createToolBox(); + if (toolBox) + toolBox->setVisible(visible); +#endif +} + void QDeclarativeViewObserverPrivate::_q_reloadView() { subcomponentEditorTool->clear(); @@ -906,14 +917,13 @@ void QDeclarativeViewObserverPrivate::createToolBox() verticalLayout->setMargin(0); verticalLayout->addWidget(toolBar); - QWidget *toolBox = new QWidget(q->declarativeView(), Qt::Tool); + toolBox = new QWidget(q->declarativeView(), Qt::Tool); toolBox->setWindowFlags((toolBox->windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint); toolBox->setWindowTitle(tr("Qt Quick Toolbox")); toolBox->setLayout(verticalLayout); toolBox->restoreGeometry(settings->value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray()); - toolBox->show(); } } //namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h index babcaa48b22479e493cf3b3fa60a76141cedcd76..4219eeed6a99186062dc251f8ba4088ae8ec3546 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h @@ -94,6 +94,7 @@ public: qreal slowdownFactor; QmlToolBar *toolBar; + QWidget *toolBox; QSettings *settings; void setViewport(QWidget *widget); @@ -127,6 +128,8 @@ public: void enterContext(QGraphicsItem *itemToEnter); public slots: + void _q_setToolBoxVisible(bool visible); + void _q_reloadView(); void _q_onStatusChanged(QDeclarativeView::Status status); void _q_onCurrentObjectsChanged(QList<QObject*> objects);