diff --git a/src/tools/qml/qmlviewer/editor/boundingrecthighlighter.cpp b/src/tools/qml/qmlviewer/editor/boundingrecthighlighter.cpp index 83be4e4c091798bb561a5ebb24ffc42196fec367..4d447793779410728098fd65a7a183797c9130bb 100644 --- a/src/tools/qml/qmlviewer/editor/boundingrecthighlighter.cpp +++ b/src/tools/qml/qmlviewer/editor/boundingrecthighlighter.cpp @@ -87,13 +87,17 @@ void BoundingRectHighlighter::highlight(QGraphicsObject* item) polygonItemEdge = m_highlightPolygonEdge; } - QPolygonF boundingRectInSceneSpace(item->mapToScene(item->boundingRect())); - QPolygonF boundingRectInLayerItemSpace = mapFromScene(boundingRectInSceneSpace); - polygonItem->setPolygon(boundingRectInLayerItemSpace); - polygonItem->setFlag(QGraphicsItem::ItemIsSelectable, false); + QRectF itemAndChildRect = item->boundingRect() | item->childrenBoundingRect(); + QPolygonF boundingRectInSceneSpace(item->mapToScene(itemAndChildRect)); + QPolygonF boundingRectInLayerItemSpace = mapFromScene(boundingRectInSceneSpace); + QRectF bboxRect = boundingRectInLayerItemSpace.boundingRect(); QRectF edgeRect = boundingRectInLayerItemSpace.boundingRect(); edgeRect.adjust(-1, -1, 1, 1); + + polygonItem->setPolygon(QPolygonF(bboxRect)); + polygonItem->setFlag(QGraphicsItem::ItemIsSelectable, false); + polygonItemEdge->setPolygon(QPolygonF(edgeRect)); polygonItemEdge->setFlag(QGraphicsItem::ItemIsSelectable, false); diff --git a/src/tools/qml/qmlviewer/editor/colorpickertool.cpp b/src/tools/qml/qmlviewer/editor/colorpickertool.cpp index 62d5f3b49c08e83063b25ecc748d01d7f6253223..00007c2f525ff50f83b68f1a0e3c2c58cd00ae0f 100644 --- a/src/tools/qml/qmlviewer/editor/colorpickertool.cpp +++ b/src/tools/qml/qmlviewer/editor/colorpickertool.cpp @@ -7,8 +7,7 @@ #include <QRgb> #include <QImage> #include <QApplication> - -#include <QDebug> +#include <QPalette> namespace QmlViewer { @@ -25,7 +24,6 @@ ColorPickerTool::~ColorPickerTool() void ColorPickerTool::mousePressEvent(QMouseEvent */*event*/) { - } void ColorPickerTool::mouseMoveEvent(QMouseEvent *event) @@ -40,33 +38,26 @@ void ColorPickerTool::mouseReleaseEvent(QMouseEvent *event) void ColorPickerTool::mouseDoubleClickEvent(QMouseEvent */*event*/) { - } void ColorPickerTool::hoverMoveEvent(QMouseEvent */*event*/) { - } void ColorPickerTool::keyPressEvent(QKeyEvent */*event*/) { - } void ColorPickerTool::keyReleaseEvent(QKeyEvent */*keyEvent*/) { - } - void ColorPickerTool::wheelEvent(QWheelEvent */*event*/) { - } void ColorPickerTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/) { - } void ColorPickerTool::clear() @@ -76,19 +67,22 @@ void ColorPickerTool::clear() void ColorPickerTool::graphicsObjectsChanged(const QList<QGraphicsObject*> &/*itemList*/) { - } void ColorPickerTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/) { - } void ColorPickerTool::pickColor(const QPoint &pos) { + QRgb fillColor = view()->backgroundBrush().color().rgb(); + if (view()->backgroundBrush().style() == Qt::NoBrush) + fillColor = view()->palette().color(QPalette::Base).rgb(); + QRectF target(0,0, 1, 1); QRect source(pos.x(), pos.y(), 1, 1); QImage img(1, 1, QImage::Format_ARGB32); + img.fill(fillColor); QPainter painter(&img); view()->render(&painter, target, source); m_selectedColor = QColor::fromRgb(img.pixel(0, 0)); diff --git a/src/tools/qml/qmlviewer/editor/qmlviewerconstants.h b/src/tools/qml/qmlviewer/editor/qmlviewerconstants.h index aa9c1666da827fa122016050568fc1d06bf770ca..4cf90e19eee2270091d1c08dbe58238e764bea0a 100644 --- a/src/tools/qml/qmlviewer/editor/qmlviewerconstants.h +++ b/src/tools/qml/qmlviewer/editor/qmlviewerconstants.h @@ -25,6 +25,8 @@ static const int DragStartDistance = 20; static const double ZoomSnapDelta = 0.04; +static const int EditorItemDataKey = 1000; + enum GraphicsItemTypes { EditorItemType = 0xEAAA, ResizeHandleItemType = 0xEAEA diff --git a/src/tools/qml/qmlviewer/editor/selectionindicator.cpp b/src/tools/qml/qmlviewer/editor/selectionindicator.cpp index e16a0a1e60076caaaf2baf2551de5b9014f5d2d1..0bed179e5f52fbc42527a4132e3641497e6c74d0 100644 --- a/src/tools/qml/qmlviewer/editor/selectionindicator.cpp +++ b/src/tools/qml/qmlviewer/editor/selectionindicator.cpp @@ -28,6 +28,8 @@ **************************************************************************/ #include "selectionindicator.h" +#include "qdeclarativedesignview.h" +#include "qmlviewerconstants.h" #include <QPen> #include <cmath> @@ -35,8 +37,8 @@ namespace QmlViewer { -SelectionIndicator::SelectionIndicator(LayerItem *layerItem) - : m_layerItem(layerItem) +SelectionIndicator::SelectionIndicator(QDeclarativeDesignView *editorView, LayerItem *layerItem) + : m_layerItem(layerItem), m_view(editorView) { } @@ -77,27 +79,41 @@ void SelectionIndicator::clear() // //} +QPolygonF SelectionIndicator::addBoundingRectToPolygon(QGraphicsItem *item, QPolygonF &polygon) +{ + polygon = polygon.united(item->mapToScene(item->boundingRect())); + foreach(QGraphicsItem *child, item->childItems()) { + if (!m_view->isEditorItem(child)) + addBoundingRectToPolygon(child, polygon); + } + return polygon; +} + void SelectionIndicator::setItems(const QList<QGraphicsObject*> &itemList) { clear(); + // set selections to also all children if they are not editor items + foreach (QGraphicsItem *item, itemList) { QGraphicsPolygonItem *newSelectionIndicatorGraphicsItem = new QGraphicsPolygonItem(m_layerItem.data()); m_indicatorShapeHash.insert(item, newSelectionIndicatorGraphicsItem); - QPolygonF boundingRectInSceneSpace(item->mapToScene(item->boundingRect())); - QPolygonF boundingRectInLayerItemSpace = m_layerItem->mapFromScene(boundingRectInSceneSpace); - newSelectionIndicatorGraphicsItem->setPolygon(boundingRectInLayerItemSpace); - newSelectionIndicatorGraphicsItem->setFlag(QGraphicsItem::ItemIsSelectable, false); + QPolygonF boundingShapeInSceneSpace; + addBoundingRectToPolygon(item, boundingShapeInSceneSpace); + + QPolygonF boundingRectInLayerItemSpace = m_layerItem->mapFromScene(boundingShapeInSceneSpace); + QPen pen; pen.setColor(QColor(108, 141, 221)); + newSelectionIndicatorGraphicsItem->setData(Constants::EditorItemDataKey, QVariant(true)); + newSelectionIndicatorGraphicsItem->setFlag(QGraphicsItem::ItemIsSelectable, false); + newSelectionIndicatorGraphicsItem->setPolygon(boundingRectInLayerItemSpace); newSelectionIndicatorGraphicsItem->setPen(pen); } } - - void SelectionIndicator::updateItems(const QList<QGraphicsObject*> &itemList) { foreach (QGraphicsItem *item, itemList) { diff --git a/src/tools/qml/qmlviewer/editor/selectionindicator.h b/src/tools/qml/qmlviewer/editor/selectionindicator.h index 5eac8ad83e7d1d3d585fac27f161635b974bb241..80e5acd972e6459ae0d8d0eb85569ad437eee05f 100644 --- a/src/tools/qml/qmlviewer/editor/selectionindicator.h +++ b/src/tools/qml/qmlviewer/editor/selectionindicator.h @@ -36,10 +36,12 @@ namespace QmlViewer { +class QDeclarativeDesignView; + class SelectionIndicator { public: - SelectionIndicator(LayerItem *layerItem); + SelectionIndicator(QDeclarativeDesignView* editorView, LayerItem *layerItem); ~SelectionIndicator(); void show(); @@ -50,9 +52,13 @@ public: void setItems(const QList<QGraphicsObject*> &itemList); void updateItems(const QList<QGraphicsObject*> &itemList); +private: + QPolygonF addBoundingRectToPolygon(QGraphicsItem *item, QPolygonF &polygon); + private: QHash<QGraphicsItem*, QGraphicsPolygonItem *> m_indicatorShapeHash; QWeakPointer<LayerItem> m_layerItem; + QDeclarativeDesignView *m_view; }; diff --git a/src/tools/qml/qmlviewer/editor/selectionrectangle.cpp b/src/tools/qml/qmlviewer/editor/selectionrectangle.cpp index 74a308e0c1c32249814f2387b8a7425e8bb111d6..3229c5853bce076f70c374ed5b0b52d870ea2d5a 100644 --- a/src/tools/qml/qmlviewer/editor/selectionrectangle.cpp +++ b/src/tools/qml/qmlviewer/editor/selectionrectangle.cpp @@ -28,6 +28,7 @@ **************************************************************************/ #include "selectionrectangle.h" +#include "qmlviewerconstants.h" #include <QPen> #include <QGraphicsScene> @@ -37,8 +38,15 @@ namespace QmlViewer { +class SelectionRectShape : public QGraphicsRectItem +{ +public: + SelectionRectShape(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {} + int type() const { return Constants::EditorItemType; } +}; + SelectionRectangle::SelectionRectangle(LayerItem *layerItem) - : m_controlShape(new QGraphicsRectItem(layerItem)), + : m_controlShape(new SelectionRectShape(layerItem)), m_layerItem(layerItem) { m_controlShape->setPen(QPen(Qt::black)); diff --git a/src/tools/qml/qmlviewer/editor/selectiontool.cpp b/src/tools/qml/qmlviewer/editor/selectiontool.cpp index c2f4dac8d7d41c946f32e7ee6b8075b821f32ca6..fd1e0579c0d109d80775bdd2c45e48779ee094f3 100644 --- a/src/tools/qml/qmlviewer/editor/selectiontool.cpp +++ b/src/tools/qml/qmlviewer/editor/selectiontool.cpp @@ -54,7 +54,7 @@ SelectionTool::SelectionTool(QDeclarativeDesignView *editorView) m_rubberbandSelectionMode(false), m_rubberbandSelectionManipulator(editorView->manipulatorLayer(), editorView), m_singleSelectionManipulator(editorView), - m_selectionIndicator(editorView->manipulatorLayer()), + m_selectionIndicator(editorView, editorView->manipulatorLayer()), //m_resizeIndicator(editorView->manipulatorLayer()), m_selectOnlyContentItems(true) { @@ -166,10 +166,6 @@ void SelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint glo QMenu contextMenu; connect(&contextMenu, SIGNAL(hovered(QAction*)), this, SLOT(contextMenuElementHovered(QAction*))); -// QList<QGraphicsItem*> sortedList; -// for(int i = itemList.length(); i>= 0; i--) { -// } - m_contextMenuItemList = itemList; contextMenu.addAction("Items"); @@ -276,13 +272,12 @@ void SelectionTool::hoverMoveEvent(QMouseEvent * event) // view()->changeTool(Constants::MoveToolMode); } - QList<QGraphicsItem*> selectableItemList = view()->selectableItems(event->pos()); + QList<QGraphicsItem*> selectableItemList = view()->items(event->pos()); if (!selectableItemList.isEmpty()) { QGraphicsItem *topSelectableItem = 0; foreach(QGraphicsItem* item, selectableItemList) { - if (item - && item->type() != Constants::EditorItemType + if (!view()->isEditorItem(item) /*&& !item->qmlItemNode().isRootNode() && (QGraphicsItem->qmlItemNode().hasShowContent() || !m_selectOnlyContentItems)*/) { @@ -292,7 +287,10 @@ void SelectionTool::hoverMoveEvent(QMouseEvent * event) } view()->highlightBoundingRect(topSelectableItem); + } else { + view()->clearHighlightBoundingRect(); } + } void SelectionTool::mouseReleaseEvent(QMouseEvent *event) @@ -341,8 +339,9 @@ void SelectionTool::keyPressEvent(QKeyEvent *event) case Qt::Key_Right: case Qt::Key_Up: case Qt::Key_Down: - view()->changeTool(Constants::MoveToolMode); - view()->currentTool()->keyPressEvent(event); + // disabled for now, cannot move stuff yet. + //view()->changeTool(Constants::MoveToolMode); + //view()->currentTool()->keyPressEvent(event); break; } } diff --git a/src/tools/qml/qmlviewer/editor/subcomponenteditortool.cpp b/src/tools/qml/qmlviewer/editor/subcomponenteditortool.cpp index 01cdc17e372bcc01a2d2e555c1135d135c6db762..240668a0c6a6dccc7687b009f4582a5c23510d4b 100644 --- a/src/tools/qml/qmlviewer/editor/subcomponenteditortool.cpp +++ b/src/tools/qml/qmlviewer/editor/subcomponenteditortool.cpp @@ -14,6 +14,8 @@ namespace QmlViewer { +const qreal MaxOpacity = 0.5f; + SubcomponentEditorTool::SubcomponentEditorTool(QDeclarativeDesignView *view) : AbstractFormEditorTool(view), m_animIncrement(0.05f), @@ -44,8 +46,6 @@ bool SubcomponentEditorTool::containsCursor(const QPoint &mousePos) const if (!m_currentContext.size()) return false; - qDebug() << __FUNCTION__ << m_currentContext.top(); - QPointF scenePos = view()->mapToScene(mousePos); QRectF itemRect = m_currentContext.top()->boundingRect() | m_currentContext.top()->childrenBoundingRect(); QRectF polyRect = m_currentContext.top()->mapToScene(itemRect).boundingRect(); @@ -98,11 +98,11 @@ void SubcomponentEditorTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/* void SubcomponentEditorTool::animate() { if (m_animIncrement > 0) { - if (m_mask->opacity() + m_animIncrement < 0.5f) { + if (m_mask->opacity() + m_animIncrement < MaxOpacity) { m_mask->setOpacity(m_mask->opacity() + m_animIncrement); } else { m_animTimer->stop(); - m_mask->setOpacity(0.5f); + m_mask->setOpacity(MaxOpacity); } } else { if (m_mask->opacity() + m_animIncrement > 0) { @@ -171,6 +171,29 @@ void SubcomponentEditorTool::setCurrentItem(QGraphicsItem* contextItem) } } +QGraphicsItem *SubcomponentEditorTool::firstChildOfContext(QGraphicsItem *item) const +{ + if (!item) + return 0; + + if (isDirectChildOfContext(item)) + return item; + + QGraphicsItem *parent = item->parentItem(); + while (parent) { + if (isDirectChildOfContext(parent)) + return parent; + parent = parent->parentItem(); + } + + return 0; +} + +bool SubcomponentEditorTool::isChildOfContext(QGraphicsItem *item) const +{ + return (firstChildOfContext(item) != 0); +} + bool SubcomponentEditorTool::isDirectChildOfContext(QGraphicsItem *item) const { return (item->parentItem() == m_currentContext.top()); @@ -212,7 +235,7 @@ QGraphicsObject *SubcomponentEditorTool::popContext() QGraphicsObject *popped = m_currentContext.pop(); if (m_currentContext.size() > 1) { m_mask->setCurrentItem(m_currentContext.top()); - m_mask->setOpacity(0.5f); + m_mask->setOpacity(MaxOpacity); m_mask->setVisible(true); } diff --git a/src/tools/qml/qmlviewer/editor/subcomponenteditortool.h b/src/tools/qml/qmlviewer/editor/subcomponenteditortool.h index 5ba821649b436c8de96f87b55046d996fb996a64..ea9aef4f32220011e8a4dc157158ff96ecffaddc 100644 --- a/src/tools/qml/qmlviewer/editor/subcomponenteditortool.h +++ b/src/tools/qml/qmlviewer/editor/subcomponenteditortool.h @@ -37,7 +37,10 @@ public: bool containsCursor(const QPoint &mousePos) const; bool itemIsChildOfQmlSubComponent(QGraphicsItem *item) const; + + bool isChildOfContext(QGraphicsItem *item) const; bool isDirectChildOfContext(QGraphicsItem *item) const; + QGraphicsItem *firstChildOfContext(QGraphicsItem *item) const; void setCurrentItem(QGraphicsItem *contextObject); @@ -45,6 +48,7 @@ public: QGraphicsObject *popContext(); QGraphicsObject *currentRootItem() const; + signals: void exitContextRequested(); diff --git a/src/tools/qml/qmlviewer/editor/subcomponentmasklayeritem.cpp b/src/tools/qml/qmlviewer/editor/subcomponentmasklayeritem.cpp index 5ce1a10cf80aef479b1e8a70775b828dd566f1d0..32297771441d0990d0b774f52e8d63af83fa67f3 100644 --- a/src/tools/qml/qmlviewer/editor/subcomponentmasklayeritem.cpp +++ b/src/tools/qml/qmlviewer/editor/subcomponentmasklayeritem.cpp @@ -13,8 +13,9 @@ SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeDesignView *vie { m_borderRect->setRect(0,0,0,0); m_borderRect->setPen(QPen(QColor(60, 60, 60), 1)); + m_borderRect->setData(Constants::EditorItemDataKey, QVariant(true)); - setBrush(QBrush(Qt::black)); + setBrush(QBrush(QColor(160,160,160))); setPen(Qt::NoPen); } diff --git a/src/tools/qml/qmlviewer/qdeclarativedesignview.cpp b/src/tools/qml/qmlviewer/qdeclarativedesignview.cpp index 781b2d79a94b0267e47ee9374904359808c23ad7..92e4a9977077facd87528f9bbe55781b27cfeaf6 100644 --- a/src/tools/qml/qmlviewer/qdeclarativedesignview.cpp +++ b/src/tools/qml/qmlviewer/qdeclarativedesignview.cpp @@ -67,6 +67,15 @@ void QDeclarativeDesignView::reloadView() emit reloadRequested(); } +void QDeclarativeDesignView::leaveEvent(QEvent *event) +{ + if (!designModeBehavior()) { + QDeclarativeView::leaveEvent(event); + return; + } + clearHighlightBoundingRect(); +} + void QDeclarativeDesignView::mousePressEvent(QMouseEvent *event) { if (!designModeBehavior()) { @@ -140,6 +149,12 @@ void QDeclarativeDesignView::keyReleaseEvent(QKeyEvent *event) case Qt::Key_M: changeToMarqueeSelectTool(); break; + case Qt::Key_I: + changeToColorPickerTool(); + break; + case Qt::Key_Z: + changeToZoomTool(); + break; case Qt::Key_Enter: case Qt::Key_Return: if (!selectedItems().isEmpty()) @@ -171,13 +186,18 @@ void QDeclarativeDesignView::mouseDoubleClickEvent(QMouseEvent *event) return; } QGraphicsItem *itemToEnter = 0; - QList<QGraphicsItem*> itemList = selectableItems(event->pos()); + QList<QGraphicsItem*> itemList = items(event->pos()); + filterForSelection(itemList); + if (selectedItems().isEmpty() && !itemList.isEmpty()) { itemToEnter = itemList.first(); } else if (!selectedItems().isEmpty() && !itemList.isEmpty()) { itemToEnter = itemList.first(); } + if (itemToEnter) + itemToEnter = m_subcomponentEditorTool->firstChildOfContext(itemToEnter); + m_subcomponentEditorTool->setCurrentItem(itemToEnter); m_subcomponentEditorTool->mouseDoubleClickEvent(event); @@ -251,8 +271,13 @@ void QDeclarativeDesignView::highlightBoundingRect(QGraphicsItem *item) { if (!item) return; + QGraphicsItem *itemToHighlight = m_subcomponentEditorTool->firstChildOfContext(item); - m_boundingRectHighlighter->highlight(item->toGraphicsObject()); + if (itemToHighlight) { + m_boundingRectHighlighter->highlight(itemToHighlight->toGraphicsObject()); + } else { + clearHighlightBoundingRect(); + } } bool QDeclarativeDesignView::mouseInsideContextItem() const @@ -263,20 +288,20 @@ bool QDeclarativeDesignView::mouseInsideContextItem() const QList<QGraphicsItem*> QDeclarativeDesignView::selectableItems(const QPointF &scenePos) const { QList<QGraphicsItem*> itemlist = scene()->items(scenePos); - return filteredItemList(itemlist); + return filterForCurrentContext(itemlist); } QList<QGraphicsItem*> QDeclarativeDesignView::selectableItems(const QPoint &pos) const { QList<QGraphicsItem*> itemlist = items(pos); - return filteredItemList(itemlist); + return filterForCurrentContext(itemlist); } QList<QGraphicsItem*> QDeclarativeDesignView::selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const { QList<QGraphicsItem*> itemlist = scene()->items(sceneRect, selectionMode); - return filteredItemList(itemlist); + return filterForCurrentContext(itemlist); } void QDeclarativeDesignView::changeToSingleSelectTool() @@ -369,13 +394,12 @@ void QDeclarativeDesignView::continueExecution(qreal slowdownFactor) void QDeclarativeDesignView::pauseExecution() { QUnifiedTimer *timer = QUnifiedTimer::instance(); - m_slowdownFactor = 0; - timer->setSlowdownFactor(m_slowdownFactor); + timer->setSlowdownFactor(0); timer->setSlowModeEnabled(true); m_executionPaused = true; emit executionPaused(); - qmlDesignDebugServer()->setAnimationSpeed(m_slowdownFactor); + qmlDesignDebugServer()->setAnimationSpeed(0); } void QDeclarativeDesignView::applyChangesFromClient() @@ -388,20 +412,46 @@ LayerItem *QDeclarativeDesignView::manipulatorLayer() const return m_manipulatorLayer; } -QList<QGraphicsItem*> QDeclarativeDesignView::filteredItemList(QList<QGraphicsItem*> &itemlist) const +QList<QGraphicsItem*> QDeclarativeDesignView::filterForSelection(QList<QGraphicsItem*> &itemlist) const { foreach(QGraphicsItem *item, itemlist) { - if (item->type() == Constants::EditorItemType - || item->type() == Constants::ResizeHandleItemType - || !m_subcomponentEditorTool->isDirectChildOfContext(item)) - { + if (isEditorItem(item) || !m_subcomponentEditorTool->isChildOfContext(item)) itemlist.removeOne(item); + } + + return itemlist; +} + +QList<QGraphicsItem*> QDeclarativeDesignView::filterForCurrentContext(QList<QGraphicsItem*> &itemlist) const +{ + foreach(QGraphicsItem *item, itemlist) { + + if (isEditorItem(item) || !m_subcomponentEditorTool->isDirectChildOfContext(item)) { + int index = itemlist.indexOf(item); + + // if we're a child, but not directly, replace with the parent that is directly in context. + if (QGraphicsItem *contextParent = m_subcomponentEditorTool->firstChildOfContext(item)) { + if (index >= 0) { + itemlist.replace(index, contextParent); + } else { + itemlist.append(contextParent); + } + } else { + itemlist.removeAt(index); + } } + } return itemlist; } +bool QDeclarativeDesignView::isEditorItem(QGraphicsItem *item) const +{ + return (item->type() == Constants::EditorItemType + || item->type() == Constants::ResizeHandleItemType + || item->data(Constants::EditorItemDataKey).toBool()); +} void QDeclarativeDesignView::onStatusChanged(QDeclarativeView::Status status) { diff --git a/src/tools/qml/qmlviewer/qdeclarativedesignview.h b/src/tools/qml/qmlviewer/qdeclarativedesignview.h index e1410ea46edf769b2497101d092f202aaf98e9a9..d51f9041fe148f807b13dfbf7095e98589dc2016 100644 --- a/src/tools/qml/qmlviewer/qdeclarativedesignview.h +++ b/src/tools/qml/qmlviewer/qdeclarativedesignview.h @@ -39,6 +39,8 @@ public: void highlightBoundingRect(QGraphicsItem *item); bool mouseInsideContextItem() const; + bool isEditorItem(QGraphicsItem *item) const; + QList<QGraphicsItem*> selectableItems(const QPoint &pos) const; QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const; QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; @@ -71,6 +73,7 @@ Q_SIGNALS: void executionPaused(); protected: + void leaveEvent(QEvent *); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); @@ -88,7 +91,8 @@ private Q_SLOTS: private: void createToolbar(); void changeToSelectTool(); - QList<QGraphicsItem*> filteredItemList(QList<QGraphicsItem*> &itemlist) const; + QList<QGraphicsItem*> filterForCurrentContext(QList<QGraphicsItem*> &itemlist) const; + QList<QGraphicsItem*> filterForSelection(QList<QGraphicsItem*> &itemlist) const; private: QPointF m_cursorPos;