From: Kai Koehne Date: Wed, 2 Nov 2011 11:19:56 +0000 (+0100) Subject: Debugger: Remove widgets dependency for qtquick2 inspector X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=030b3d1ceca96bfa2a04f761d574887687c666c1;p=konrad%2Fqtdeclarative.git Debugger: Remove widgets dependency for qtquick2 inspector Change-Id: I596a49375afc1e148fec1aabe0a7d47a81e7442a Reviewed-by: Friedemann Kleint --- diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.cpp index 025aa2d..4d5fc37 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.cpp @@ -44,7 +44,6 @@ #include "sghighlight.h" #include "sgviewinspector.h" -#include #include #include #include @@ -69,8 +68,7 @@ void SGSelectionTool::mousePressEvent(QMouseEvent *event) if (QQuickItem *item = inspector()->topVisibleItemAt(event->pos())) inspector()->setSelectedItems(QList() << item); } else if (event->button() == Qt::RightButton) { - QList items = inspector()->itemsAt(event->pos()); - createContextMenu(items, event->globalPos()); + // todo: Show context menu } } @@ -85,49 +83,6 @@ void SGSelectionTool::hoverMoveEvent(QMouseEvent *event) } } -void SGSelectionTool::createContextMenu(const QList &items, QPoint pos) -{ - QMenu contextMenu; - connect(&contextMenu, SIGNAL(hovered(QAction*)), - this, SLOT(contextMenuElementHovered(QAction*))); - - const QList selectedItems = inspector()->selectedItems(); - int shortcutKey = Qt::Key_1; - - foreach (QQuickItem *item, items) { - const QString title = inspector()->titleForItem(item); - QAction *elementAction = contextMenu.addAction(title); - elementAction->setData(QVariant::fromValue(item)); - - connect(elementAction, SIGNAL(triggered()), this, SLOT(contextMenuElementSelected())); - - if (selectedItems.contains(item)) { - QFont font = elementAction->font(); - font.setBold(true); - elementAction->setFont(font); - } - - if (shortcutKey <= Qt::Key_9) { - elementAction->setShortcut(QKeySequence(shortcutKey)); - shortcutKey++; - } - } - - contextMenu.exec(pos); -} - -void SGSelectionTool::contextMenuElementHovered(QAction *action) -{ - if (QQuickItem *item = action->data().value()) - m_hoverHighlight->setItem(item); -} - -void SGSelectionTool::contextMenuElementSelected() -{ - if (QQuickItem *item = static_cast(sender())->data().value()) - inspector()->setSelectedItems(QList() << item); -} - SGViewInspector *SGSelectionTool::inspector() const { return static_cast(AbstractTool::inspector()); diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.h b/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.h index fe338bd..faf75be 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.h +++ b/src/plugins/qmltooling/qmldbg_qtquick2/sgselectiontool.h @@ -47,7 +47,6 @@ #include #include -QT_FORWARD_DECLARE_CLASS(QAction) QT_FORWARD_DECLARE_CLASS(QQuickItem) namespace QmlJSDebugger { @@ -75,13 +74,7 @@ public: void keyPressEvent(QKeyEvent *) {} void keyReleaseEvent(QKeyEvent *) {} -private slots: - void contextMenuElementHovered(QAction *action); - void contextMenuElementSelected(); - private: - void createContextMenu(const QList &items, QPoint pos); - SGViewInspector *inspector() const; SGHoverHighlight *m_hoverHighlight;