diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2024-03-06 12:59:50 +0100 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2024-03-06 12:29:01 +0000 |
commit | f6528007afcb1b7044e53824fca3651399cce27a (patch) | |
tree | c9ff104d1e26271147f7e5c6c178ce0ed8a4a16a | |
parent | cf67c1aee66f4a2e2be9e6fb957de51392e38bcd (diff) |
QmlDesigner: Remove ContentNotEditableIndicator
The indicator was used for tab views of controls 1.
There is no current use case. We have seen
crashes related to the indicator.
Change-Id: I0466aecfd5ae598e07ebbfe8d1277ce23116e183
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
7 files changed, 8 insertions, 161 deletions
diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 66af859a61..09d0aa01c0 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -667,7 +667,6 @@ extend_qtc_plugin(QmlDesigner backgroundaction.cpp backgroundaction.h bindingindicator.cpp bindingindicator.h bindingindicatorgraphicsitem.cpp bindingindicatorgraphicsitem.h - contentnoteditableindicator.cpp contentnoteditableindicator.h controlelement.cpp controlelement.h dragtool.cpp dragtool.h formeditor.qrc diff --git a/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp b/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp deleted file mode 100644 index 8c40c8c358..0000000000 --- a/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "contentnoteditableindicator.h" -#include "nodemetainfo.h" - -#include <utils/algorithm.h> - -#include <QSet> -#include <QPen> - -namespace QmlDesigner { - -ContentNotEditableIndicator::ContentNotEditableIndicator(LayerItem *layerItem) - : m_layerItem(layerItem) -{ - -} - -ContentNotEditableIndicator::ContentNotEditableIndicator() = default; - -ContentNotEditableIndicator::~ContentNotEditableIndicator() -{ - clear(); -} - -void ContentNotEditableIndicator::clear() -{ - for (const EntryPair &entryPair : std::as_const(m_entryList)) { - delete entryPair.second; - entryPair.first->blurContent(false); - } - - m_entryList.clear(); -} - -bool operator ==(const ContentNotEditableIndicator::EntryPair &firstPair, const ContentNotEditableIndicator::EntryPair &secondPair) -{ - return firstPair.first == secondPair.first; -} - -void ContentNotEditableIndicator::setItems(const QList<FormEditorItem*> &itemList) -{ - removeEntriesWhichAreNotInTheList(itemList); - addAddiationEntries(itemList); -} - -void ContentNotEditableIndicator::updateItems(const QList<FormEditorItem *> &itemList) -{ - QSet<FormEditorItem*> affectedFormEditorItemItems; - affectedFormEditorItemItems.unite(Utils::toSet(itemList)); - for (FormEditorItem *formEditorItem : itemList) - affectedFormEditorItemItems.unite(Utils::toSet(formEditorItem->offspringFormEditorItems())); - - for (const EntryPair &entryPair : std::as_const(m_entryList)) { - for (FormEditorItem *formEditorItem : std::as_const(affectedFormEditorItemItems)) { - if (formEditorItem == entryPair.first) { - QRectF boundingRectangleInSceneSpace - = formEditorItem->qmlItemNode().instanceSceneTransform().mapRect( - formEditorItem->qmlItemNode().instanceBoundingRect()); - entryPair.second->setRect(boundingRectangleInSceneSpace); - entryPair.second->update(); - } - } - } -} - -void ContentNotEditableIndicator::addAddiationEntries(const QList<FormEditorItem *> &itemList) -{ - for (FormEditorItem *formEditorItem : itemList) { - const ModelNode modelNode = formEditorItem->qmlItemNode().modelNode(); - if (modelNode.metaInfo().isValid() && modelNode.metaInfo().isQtQuickLoader()) { - if (!m_entryList.contains(EntryPair(formEditorItem, 0))) { - auto indicatorShape = new QGraphicsRectItem(m_layerItem); - QPen linePen; - linePen.setCosmetic(true); - linePen.setColor(QColor(0xa0, 0xa0, 0xa0)); - indicatorShape->setPen(linePen); - QRectF boundingRectangleInSceneSpace = formEditorItem->qmlItemNode().instanceSceneTransform().mapRect(formEditorItem->qmlItemNode().instanceBoundingRect()); - indicatorShape->setRect(boundingRectangleInSceneSpace); - static QBrush brush(QColor(0, 0, 0, 10), Qt::BDiagPattern); - indicatorShape->setBrush(brush); - - m_entryList.append(EntryPair(formEditorItem, indicatorShape)); - } - } - } -} - -void ContentNotEditableIndicator::removeEntriesWhichAreNotInTheList(const QList<FormEditorItem *> &itemList) -{ - for (int i = 0; i < m_entryList.size(); ++i) { - const EntryPair &entryPair = m_entryList.at(i); - if (!itemList.contains(entryPair.first)) { - delete entryPair.second; - entryPair.first->blurContent(false); - m_entryList.removeAt(i--); - } - } -} - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.h b/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.h deleted file mode 100644 index 514331e2ac..0000000000 --- a/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#pragma once - -#include "layeritem.h" -#include "formeditoritem.h" - -#include <QPointer> -#include <QGraphicsRectItem> - -namespace QmlDesigner { - -class ContentNotEditableIndicator -{ -public: - using EntryPair = QPair<FormEditorItem*, QGraphicsRectItem *>; - - ContentNotEditableIndicator(LayerItem *layerItem); - ContentNotEditableIndicator(); - ~ContentNotEditableIndicator(); - - void clear(); - - void setItems(const QList<FormEditorItem*> &itemList); - void updateItems(const QList<FormEditorItem*> &itemList); - -protected: - void addAddiationEntries(const QList<FormEditorItem*> &itemList); - void removeEntriesWhichAreNotInTheList(const QList<FormEditorItem*> &itemList); - -private: - QPointer<LayerItem> m_layerItem; - QList<EntryPair> m_entryList; -}; - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.cpp b/src/plugins/qmldesigner/components/formeditor/movetool.cpp index 0d486b0f4f..7aa66c2390 100644 --- a/src/plugins/qmldesigner/components/formeditor/movetool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movetool.cpp @@ -21,14 +21,14 @@ namespace QmlDesigner { MoveTool::MoveTool(FormEditorView *editorView) - : AbstractFormEditorTool(editorView), - m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView), - m_selectionIndicator(editorView->scene()->manipulatorLayerItem()), - m_resizeIndicator(editorView->scene()->manipulatorLayerItem()), - m_rotationIndicator(editorView->scene()->manipulatorLayerItem()), - m_anchorIndicator(editorView->scene()->manipulatorLayerItem()), - m_bindingIndicator(editorView->scene()->manipulatorLayerItem()), - m_contentNotEditableIndicator(editorView->scene()->manipulatorLayerItem()) + : AbstractFormEditorTool(editorView) + , m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView) + , m_selectionIndicator(editorView->scene()->manipulatorLayerItem()) + , m_resizeIndicator(editorView->scene()->manipulatorLayerItem()) + , m_rotationIndicator(editorView->scene()->manipulatorLayerItem()) + , m_anchorIndicator(editorView->scene()->manipulatorLayerItem()) + , m_bindingIndicator(editorView->scene()->manipulatorLayerItem()) + { m_selectionIndicator.setCursor(Qt::SizeAllCursor); } @@ -44,7 +44,6 @@ void MoveTool::clear() m_rotationIndicator.clear(); m_anchorIndicator.clear(); m_bindingIndicator.clear(); - m_contentNotEditableIndicator.clear(); AbstractFormEditorTool::clear(); if (view()->formEditorWidget()->graphicsView()) @@ -142,9 +141,6 @@ void MoveTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList, view()->changeToSelectionTool(); return; } - - - m_contentNotEditableIndicator.setItems(toFormEditorItemList(itemList)); } void MoveTool::keyPressEvent(QKeyEvent *event) @@ -381,7 +377,6 @@ void MoveTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList) m_rotationIndicator.updateItems(selectedItemList); m_anchorIndicator.updateItems(selectedItemList); m_bindingIndicator.updateItems(selectedItemList); - m_contentNotEditableIndicator.updateItems(selectedItemList); } void MoveTool::focusLost() diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.h b/src/plugins/qmldesigner/components/formeditor/movetool.h index e7176f3263..0370c9010d 100644 --- a/src/plugins/qmldesigner/components/formeditor/movetool.h +++ b/src/plugins/qmldesigner/components/formeditor/movetool.h @@ -9,7 +9,6 @@ #include "rotationindicator.h" #include "anchorindicator.h" #include "bindingindicator.h" -#include "contentnoteditableindicator.h" namespace QmlDesigner { @@ -66,7 +65,6 @@ private: RotationIndicator m_rotationIndicator; AnchorIndicator m_anchorIndicator; BindingIndicator m_bindingIndicator; - ContentNotEditableIndicator m_contentNotEditableIndicator; QList<FormEditorItem*> m_movingItems; }; diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp index 282208f3b1..d30539d52b 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp @@ -31,7 +31,6 @@ SelectionTool::SelectionTool(FormEditorView *editorView) , m_rotationIndicator(editorView->scene()->manipulatorLayerItem()) , m_anchorIndicator(editorView->scene()->manipulatorLayerItem()) , m_bindingIndicator(editorView->scene()->manipulatorLayerItem()) - , m_contentNotEditableIndicator(editorView->scene()->manipulatorLayerItem()) { m_selectionIndicator.setCursor(Qt::ArrowCursor); } @@ -143,8 +142,6 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList, } scene()->highlightBoundingRect(topSelectableItem); - - m_contentNotEditableIndicator.setItems(toFormEditorItemList(itemList)); } void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, @@ -250,7 +247,6 @@ void SelectionTool::clear() m_rotationIndicator.clear(); m_anchorIndicator.clear(); m_bindingIndicator.clear(); - m_contentNotEditableIndicator.clear(); AbstractFormEditorTool::clear(); } @@ -273,7 +269,6 @@ void SelectionTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemLis m_rotationIndicator.updateItems(selectedItemList); m_anchorIndicator.updateItems(selectedItemList); m_bindingIndicator.updateItems(selectedItemList); - m_contentNotEditableIndicator.updateItems(selectedItemList); } void SelectionTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/) diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.h b/src/plugins/qmldesigner/components/formeditor/selectiontool.h index 712de3ccf8..5453c43ac4 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.h +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.h @@ -10,7 +10,6 @@ #include "rotationindicator.h" #include "anchorindicator.h" #include "bindingindicator.h" -#include "contentnoteditableindicator.h" #include <QElapsedTimer> #include <QTime> @@ -67,7 +66,6 @@ private: RotationIndicator m_rotationIndicator; AnchorIndicator m_anchorIndicator; BindingIndicator m_bindingIndicator; - ContentNotEditableIndicator m_contentNotEditableIndicator; QElapsedTimer m_mousePressTimer; QCursor m_cursor; bool m_itemSelectedAndMovable = false; |