aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2012-04-04 10:33:00 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-10 13:11:00 +0200
commit0d1365e18cd99704058d1fc444d682c63f22fbef (patch)
tree32b3e536e6cf62032cf1bd478efa4a6ec7f43ae7 /src/plugins
parent69ad0d9591de9a074d709823da7288c1c09d17ad (diff)
QmlDebug: Combine Selection and Zoom Tools
Combine the Selection and Zoom Tools into Inspect Tool. Change-Id: I2477e2b27f5dde5d74489ecf3c43a049e2ed3aa3 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp (renamed from src/plugins/qmltooling/qmldbg_qtquick2/zoomtool.cpp)135
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h (renamed from src/plugins/qmltooling/qmldbg_qtquick2/zoomtool.h)36
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro6
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp20
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h6
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.cpp92
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.h86
-rw-r--r--src/plugins/qmltooling/shared/abstractviewinspector.cpp14
-rw-r--r--src/plugins/qmltooling/shared/abstractviewinspector.h5
-rw-r--r--src/plugins/qmltooling/shared/qmlinspectorconstants.h4
-rw-r--r--src/plugins/qmltooling/shared/qqmlinspectorprotocol.h3
11 files changed, 121 insertions, 286 deletions
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/zoomtool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
index 3efd816b00..26b27b6043 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/zoomtool.cpp
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
@@ -39,14 +39,19 @@
**
****************************************************************************/
-#include "zoomtool.h"
+#include "inspecttool.h"
+
+#include "highlight.h"
#include "qquickviewinspector.h"
#include <QtCore/QLineF>
+
#include <QtGui/QMouseEvent>
#include <QtGui/QWheelEvent>
#include <QtGui/QTouchEvent>
#include <QtGui/QKeyEvent>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QStyleHints>
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickItem>
@@ -54,15 +59,15 @@
namespace QmlJSDebugger {
namespace QtQuick2 {
-ZoomTool::ZoomTool(QQuickViewInspector *inspector, QQuickView *view) :
+InspectTool::InspectTool(QQuickViewInspector *inspector, QQuickView *view) :
AbstractTool(inspector),
m_dragStarted(false),
m_pinchStarted(false),
m_currentScale(1.0f),
- m_smoothScaleFactor(0.05f),
+ m_smoothScaleFactor(Constants::ZoomSnapDelta),
m_minScale(0.125f),
m_maxScale(48.0f),
- m_tapScaleCounter(0)
+ m_hoverHighlight(new HoverHighlight(inspector->overlay()))
{
m_rootItem = view->rootItem();
m_originalSmooth = m_rootItem->smooth();
@@ -72,7 +77,7 @@ ZoomTool::ZoomTool(QQuickViewInspector *inspector, QQuickView *view) :
m_originalScale = m_rootItem->scale();
}
-ZoomTool::~ZoomTool()
+InspectTool::~InspectTool()
{
// restoring the original states.
if (m_rootItem) {
@@ -83,40 +88,41 @@ ZoomTool::~ZoomTool()
}
}
-void ZoomTool::mousePressEvent(QMouseEvent *event)
+void InspectTool::leaveEvent(QEvent *)
{
- m_mousePosition = event->posF();
- if (event->buttons() & Qt::LeftButton) {
- m_dragStartPosition = event->posF();
- m_dragStarted = false;
- }
+ m_hoverHighlight->setVisible(false);
}
-void ZoomTool::mouseMoveEvent(QMouseEvent *event)
+void InspectTool::mousePressEvent(QMouseEvent *event)
{
- if (m_pinchStarted)
- return;
-
m_mousePosition = event->posF();
- if (!m_dragStarted
- && event->buttons() & Qt::LeftButton
- && ((m_dragStartPosition - event->posF()).manhattanLength()
- > Constants::DragStartDistance)) {
- m_dragStarted = true;
- }
- if (m_dragStarted) {
- m_adjustedOrigin += event->posF() - m_dragStartPosition;
- m_dragStartPosition = event->posF();
- m_rootItem->setPos(m_adjustedOrigin);
+ if (event->button() == Qt::LeftButton) {
+ if (QQuickItem *item = inspector()->topVisibleItemAt(event->pos()))
+ inspector()->setSelectedItems(QList<QQuickItem*>() << item);
+ initializeDrag(event->posF());
+ } else if (event->button() == Qt::RightButton) {
+ // todo: Show context menu
}
}
-void ZoomTool::hoverMoveEvent(QMouseEvent *event)
+void InspectTool::mouseMoveEvent(QMouseEvent *event)
{
m_mousePosition = event->posF();
+ moveItem(event->buttons() & Qt::LeftButton);
}
-void ZoomTool::wheelEvent(QWheelEvent *event)
+void InspectTool::hoverMoveEvent(QMouseEvent *event)
+{
+ QQuickItem *item = inspector()->topVisibleItemAt(event->pos());
+ if (!item) {
+ m_hoverHighlight->setVisible(false);
+ } else {
+ m_hoverHighlight->setItem(item);
+ m_hoverHighlight->setVisible(true);
+ }
+}
+
+void InspectTool::wheelEvent(QWheelEvent *event)
{
if (event->orientation() != Qt::Vertical)
return;
@@ -135,13 +141,7 @@ void ZoomTool::wheelEvent(QWheelEvent *event)
}
}
-void ZoomTool::mouseDoubleClickEvent(QMouseEvent *event)
-{
- m_mousePosition = event->posF();
- zoomTo100();
-}
-
-void ZoomTool::keyReleaseEvent(QKeyEvent *event)
+void InspectTool::keyReleaseEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Plus:
@@ -168,16 +168,24 @@ void ZoomTool::keyReleaseEvent(QKeyEvent *event)
}
}
-void ZoomTool::touchEvent(QTouchEvent *event)
+void InspectTool::touchEvent(QTouchEvent *event)
{
QList<QTouchEvent::TouchPoint> touchPoints = event->touchPoints();
switch (event->type()) {
case QEvent::TouchBegin:
- // fall through..
+ if (touchPoints.count() == 1 && (event->touchPointStates() & Qt::TouchPointPressed)) {
+ m_mousePosition = touchPoints.first().pos();
+ initializeDrag(touchPoints.first().pos());
+ }
+ break;
case QEvent::TouchUpdate: {
- if ((touchPoints.count() == 2)
- && (!(event->touchPointStates() & Qt::TouchPointReleased))) {
+ if ((touchPoints.count() == 1)
+ && (event->touchPointStates() & Qt::TouchPointMoved)) {
+ m_mousePosition = touchPoints.first().pos();
+ moveItem(true);
+ } else if ((touchPoints.count() == 2)
+ && (!(event->touchPointStates() & Qt::TouchPointReleased))) {
// determine scale factor
const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
@@ -190,7 +198,6 @@ void ZoomTool::touchEvent(QTouchEvent *event)
QPointF newcenter = (touchPoint0.pos() + touchPoint1.pos()) / 2;
m_pinchStarted = true;
- m_tapScaleCounter = 0;
scaleView(touchScaleFactor, newcenter, oldcenter);
}
break;
@@ -198,12 +205,6 @@ void ZoomTool::touchEvent(QTouchEvent *event)
case QEvent::TouchEnd: {
if (m_pinchStarted) {
m_pinchStarted = false;
- } else if ((touchPoints.count() == 1)
- &&(!m_dragStarted)) {
- ++m_tapScaleCounter;
- qreal factor = 1.0f + (1.0f / (m_tapScaleCounter + 1));
- scaleView(factor, touchPoints.first().pos(),
- touchPoints.first().pos());
}
break;
}
@@ -212,7 +213,7 @@ void ZoomTool::touchEvent(QTouchEvent *event)
}
}
-void ZoomTool::scaleView(const qreal &factor, const QPointF &newcenter, const QPointF &oldcenter)
+void InspectTool::scaleView(const qreal &factor, const QPointF &newcenter, const QPointF &oldcenter)
{
if (((m_currentScale * factor) > m_maxScale)
|| ((m_currentScale * factor) < m_minScale)) {
@@ -226,29 +227,28 @@ void ZoomTool::scaleView(const qreal &factor, const QPointF &newcenter, const QP
m_rootItem->setPos(m_adjustedOrigin);
}
-void ZoomTool::zoomIn()
+void InspectTool::zoomIn()
{
qreal newScale = nextZoomScale(ZoomIn);
scaleView(newScale / m_currentScale, m_mousePosition, m_mousePosition);
}
-void ZoomTool::zoomOut()
+void InspectTool::zoomOut()
{
qreal newScale = nextZoomScale(ZoomOut);
scaleView(newScale / m_currentScale, m_mousePosition, m_mousePosition);
}
-void ZoomTool::zoomTo100()
+void InspectTool::zoomTo100()
{
m_currentScale = 1.0;
m_adjustedOrigin = QPointF(0, 0);
- m_tapScaleCounter = 0;
m_rootItem->setPos(m_adjustedOrigin);
m_rootItem->setScale(m_currentScale);
}
-qreal ZoomTool::nextZoomScale(ZoomDirection direction)
+qreal InspectTool::nextZoomScale(ZoomDirection direction)
{
static QList<qreal> zoomScales =
QList<qreal>()
@@ -288,5 +288,38 @@ qreal ZoomTool::nextZoomScale(ZoomDirection direction)
return 1.0f;
}
+void InspectTool::initializeDrag(const QPointF &pos)
+{
+ m_dragStartPosition = pos;
+ m_dragStarted = false;
+}
+
+void InspectTool::dragItemToPosition()
+{
+ m_adjustedOrigin += m_mousePosition - m_dragStartPosition;
+ m_dragStartPosition = m_mousePosition;
+ m_rootItem->setPos(m_adjustedOrigin);
+}
+
+void InspectTool::moveItem(bool valid)
+{
+ if (m_pinchStarted)
+ return;
+
+ if (!m_dragStarted
+ && valid
+ && ((m_dragStartPosition - m_mousePosition).manhattanLength()
+ > qApp->styleHints()->startDragDistance())) {
+ m_dragStarted = true;
+ }
+ if (m_dragStarted)
+ dragItemToPosition();
+}
+
+QQuickViewInspector *InspectTool::inspector() const
+{
+ return static_cast<QQuickViewInspector*>(AbstractTool::inspector());
+}
+
} // namespace QtQuick2
} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/zoomtool.h b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
index 6787d7a7f4..2015dba535 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/zoomtool.h
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef ZOOMTOOL_H
-#define ZOOMTOOL_H
+#ifndef INSPECTTOOL_H
+#define INSPECTTOOL_H
#include "abstracttool.h"
@@ -54,40 +54,45 @@ namespace QmlJSDebugger {
namespace QtQuick2 {
class QQuickViewInspector;
+class HoverHighlight;
-class ZoomTool : public AbstractTool
+class InspectTool : public AbstractTool
{
Q_OBJECT
-
public:
enum ZoomDirection {
ZoomIn,
ZoomOut
};
- explicit ZoomTool(QQuickViewInspector *inspector, QQuickView *view);
- virtual ~ZoomTool();
- void leaveEvent(QEvent *) {}
+ InspectTool(QQuickViewInspector *inspector, QQuickView *view);
+ ~InspectTool();
+
+ void leaveEvent(QEvent *);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *);
+ void mouseMoveEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *) {}
- void mouseDoubleClickEvent(QMouseEvent *event);
+ void mouseDoubleClickEvent(QMouseEvent *) {}
- void hoverMoveEvent(QMouseEvent *event);
- void wheelEvent(QWheelEvent *event);
+ void hoverMoveEvent(QMouseEvent *);
+ void wheelEvent(QWheelEvent *);
void keyPressEvent(QKeyEvent *) {}
- void keyReleaseEvent(QKeyEvent *event);
+ void keyReleaseEvent(QKeyEvent *);
void touchEvent(QTouchEvent *event);
private:
+ QQuickViewInspector *inspector() const;
qreal nextZoomScale(ZoomDirection direction);
void scaleView(const qreal &factor, const QPointF &newcenter, const QPointF &oldcenter);
void zoomTo100();
void zoomIn();
void zoomOut();
+ void initializeDrag(const QPointF &pos);
+ void dragItemToPosition();
+ void moveItem(bool valid);
private:
bool m_originalSmooth;
@@ -102,11 +107,12 @@ private:
qreal m_smoothScaleFactor;
qreal m_minScale;
qreal m_maxScale;
- qreal m_tapScaleCounter;
qreal m_originalScale;
+
+ HoverHighlight *m_hoverHighlight;
};
} // namespace QtQuick2
} // namespace QmlJSDebugger
-#endif // ZOOMTOOL_H
+#endif // INSPECTTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro
index 33bda11dcc..f40e3f0b04 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro
@@ -12,22 +12,20 @@ INCLUDEPATH *= $$PWD $$PWD/../shared
SOURCES += \
qtquick2plugin.cpp \
highlight.cpp \
- selectiontool.cpp \
qquickviewinspector.cpp \
../shared/abstracttool.cpp \
../shared/abstractviewinspector.cpp \
- zoomtool.cpp
+ inspecttool.cpp
HEADERS += \
qtquick2plugin.h \
highlight.h \
- selectiontool.h \
qquickviewinspector.h \
../shared/abstracttool.h \
../shared/abstractviewinspector.h \
../shared/qqmlinspectorprotocol.h \
../shared/qmlinspectorconstants.h \
- zoomtool.h
+ inspecttool.h
OTHER_FILES += qtquick2plugin.json
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp
index 0a73540b40..c444b3de94 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp
@@ -43,8 +43,7 @@
#include "qqmlinspectorprotocol.h"
#include "highlight.h"
-#include "selectiontool.h"
-#include "zoomtool.h"
+#include "inspecttool.h"
#include <QtQuick/private/qquickitem_p.h>
@@ -120,8 +119,7 @@ QQuickViewInspector::QQuickViewInspector(QQuickView *view, QObject *parent) :
AbstractViewInspector(parent),
m_view(view),
m_overlay(new QQuickItem),
- m_selectionTool(new SelectionTool(this)),
- m_zoomTool(0),
+ m_inspectTool(new InspectTool(this, view)),
m_designMode(true)
{
// Try to make sure the overlay is always on top
@@ -131,7 +129,7 @@ QQuickViewInspector::QQuickViewInspector(QQuickView *view, QObject *parent) :
m_overlay->setParentItem(root);
view->installEventFilter(this);
- setCurrentTool(m_selectionTool);
+ setCurrentTool(m_inspectTool);
}
void QQuickViewInspector::changeCurrentObjects(const QList<QObject*> &objects)
@@ -173,15 +171,9 @@ void QQuickViewInspector::changeTool(InspectorProtocol::Tool tool)
// TODO
emit marqueeSelectToolActivated();
break;
- case InspectorProtocol::SelectTool:
- setCurrentTool(m_selectionTool);
- emit selectToolActivated();
- break;
- case InspectorProtocol::ZoomTool:
- if (!m_zoomTool)
- m_zoomTool = new ZoomTool(this, m_view);
- setCurrentTool(m_zoomTool);
- emit zoomToolActivated();
+ case InspectorProtocol::InspectTool:
+ setCurrentTool(m_inspectTool);
+ emit inspectToolActivated();
break;
}
}
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h
index e8fdf351de..0fd2948279 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h
@@ -55,9 +55,8 @@ QT_END_NAMESPACE
namespace QmlJSDebugger {
namespace QtQuick2 {
-class SelectionTool;
+class InspectTool;
class SelectionHighlight;
-class ZoomTool;
class QQuickViewInspector : public AbstractViewInspector
{
@@ -99,8 +98,7 @@ private:
QQuickView *m_view;
QQuickItem *m_overlay;
- SelectionTool *m_selectionTool;
- ZoomTool *m_zoomTool;
+ InspectTool *m_inspectTool;
QList<QWeakPointer<QQuickItem> > m_selectedItems;
QHash<QQuickItem*, SelectionHighlight*> m_highlightItems;
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.cpp
deleted file mode 100644
index 5ad102a92d..0000000000
--- a/src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "selectiontool.h"
-
-#include "highlight.h"
-#include "qquickviewinspector.h"
-
-#include <QtGui/QMouseEvent>
-#include <QtQuick/QQuickView>
-#include <QtQuick/QQuickItem>
-
-namespace QmlJSDebugger {
-namespace QtQuick2 {
-
-SelectionTool::SelectionTool(QQuickViewInspector *inspector) :
- AbstractTool(inspector),
- m_hoverHighlight(new HoverHighlight(inspector->overlay()))
-{
-}
-
-void SelectionTool::leaveEvent(QEvent *)
-{
- m_hoverHighlight->setVisible(false);
-}
-
-void SelectionTool::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton) {
- if (QQuickItem *item = inspector()->topVisibleItemAt(event->pos()))
- inspector()->setSelectedItems(QList<QQuickItem*>() << item);
- } else if (event->button() == Qt::RightButton) {
- // todo: Show context menu
- }
-}
-
-void SelectionTool::hoverMoveEvent(QMouseEvent *event)
-{
- QQuickItem *item = inspector()->topVisibleItemAt(event->pos());
- if (!item) {
- m_hoverHighlight->setVisible(false);
- } else {
- m_hoverHighlight->setItem(item);
- m_hoverHighlight->setVisible(true);
- }
-}
-
-QQuickViewInspector *SelectionTool::inspector() const
-{
- return static_cast<QQuickViewInspector*>(AbstractTool::inspector());
-}
-
-} // namespace QtQuick2
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.h b/src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.h
deleted file mode 100644
index c2aa26a1a7..0000000000
--- a/src/plugins/qmltooling/qmldbg_qtquick2/selectiontool.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SELECTIONTOOL_H
-#define SELECTIONTOOL_H
-
-#include "abstracttool.h"
-
-#include <QtCore/QList>
-#include <QtCore/QPoint>
-
-QT_FORWARD_DECLARE_CLASS(QQuickItem)
-
-namespace QmlJSDebugger {
-namespace QtQuick2 {
-
-class QQuickViewInspector;
-class HoverHighlight;
-
-class SelectionTool : public AbstractTool
-{
- Q_OBJECT
-public:
- explicit SelectionTool(QQuickViewInspector *inspector);
-
- void leaveEvent(QEvent *);
-
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *) {}
- void mouseReleaseEvent(QMouseEvent *) {}
- void mouseDoubleClickEvent(QMouseEvent *) {}
-
- void hoverMoveEvent(QMouseEvent *);
- void wheelEvent(QWheelEvent *) {}
-
- void keyPressEvent(QKeyEvent *) {}
- void keyReleaseEvent(QKeyEvent *) {}
-
-private:
- QQuickViewInspector *inspector() const;
-
- HoverHighlight *m_hoverHighlight;
-};
-
-} // namespace QtQuick2
-} // namespace QmlJSDebugger
-
-#endif // SELECTIONTOOL_H
diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.cpp b/src/plugins/qmltooling/shared/abstractviewinspector.cpp
index 135da1b8b7..c82e711b45 100644
--- a/src/plugins/qmltooling/shared/abstractviewinspector.cpp
+++ b/src/plugins/qmltooling/shared/abstractviewinspector.cpp
@@ -168,14 +168,9 @@ void AbstractViewInspector::changeToColorPickerTool()
changeTool(InspectorProtocol::ColorPickerTool);
}
-void AbstractViewInspector::changeToZoomTool()
+void AbstractViewInspector::changeToInspectTool()
{
- changeTool(InspectorProtocol::ZoomTool);
-}
-
-void AbstractViewInspector::changeToSingleSelectTool()
-{
- changeTool(InspectorProtocol::SelectTool);
+ changeTool(InspectorProtocol::InspectTool);
}
void AbstractViewInspector::changeToMarqueeSelectTool()
@@ -272,7 +267,7 @@ bool AbstractViewInspector::keyReleaseEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_V:
- changeTool(InspectorProtocol::SelectTool);
+ changeTool(InspectorProtocol::InspectTool);
break;
// disabled because multiselection does not do anything useful without design mode
// case Qt::Key_M:
@@ -281,9 +276,6 @@ bool AbstractViewInspector::keyReleaseEvent(QKeyEvent *event)
case Qt::Key_I:
changeTool(InspectorProtocol::ColorPickerTool);
break;
- case Qt::Key_Z:
- changeTool(InspectorProtocol::ZoomTool);
- break;
case Qt::Key_Space:
setAnimationPaused(!animationPaused());
break;
diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.h b/src/plugins/qmltooling/shared/abstractviewinspector.h
index 04ca02917e..581a8a5931 100644
--- a/src/plugins/qmltooling/shared/abstractviewinspector.h
+++ b/src/plugins/qmltooling/shared/abstractviewinspector.h
@@ -109,8 +109,7 @@ signals:
void showAppOnTopChanged(bool showAppOnTop);
void reloadRequested();
void marqueeSelectToolActivated();
- void selectToolActivated();
- void zoomToolActivated();
+ void inspectToolActivated();
void colorPickerActivated();
void selectedColorChanged(const QColor &color);
@@ -140,7 +139,7 @@ private:
void changeToColorPickerTool();
void changeToZoomTool();
- void changeToSingleSelectTool();
+ void changeToInspectTool();
void changeToMarqueeSelectTool();
virtual void setDesignModeBehavior(bool value);
diff --git a/src/plugins/qmltooling/shared/qmlinspectorconstants.h b/src/plugins/qmltooling/shared/qmlinspectorconstants.h
index e5a0ee5450..c24594ba2a 100644
--- a/src/plugins/qmltooling/shared/qmlinspectorconstants.h
+++ b/src/plugins/qmltooling/shared/qmlinspectorconstants.h
@@ -57,10 +57,6 @@ enum DesignTool {
ZoomMode = 6
};
-static const int DragStartTime = 50;
-
-static const int DragStartDistance = 20;
-
static const double ZoomSnapDelta = 0.04;
static const int EditorItemDataKey = 1000;
diff --git a/src/plugins/qmltooling/shared/qqmlinspectorprotocol.h b/src/plugins/qmltooling/shared/qqmlinspectorprotocol.h
index 63772aa8e4..d8807e526f 100644
--- a/src/plugins/qmltooling/shared/qqmlinspectorprotocol.h
+++ b/src/plugins/qmltooling/shared/qqmlinspectorprotocol.h
@@ -79,8 +79,7 @@ public:
enum Tool {
ColorPickerTool,
SelectMarqueeTool,
- SelectTool,
- ZoomTool
+ InspectTool
};
static inline QString toString(Message message)