forked from qt-creator/qt-creator
QmlDesigner: Update ContentNotEditableIndicator for movements
Task-number: QTCREATORBUG-10644 Change-Id: I23a02dae01faf703dbf9bd5bd643dc091a947eba Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include "contentnoteditableindicator.h"
|
||||
#include "nodemetainfo.h"
|
||||
|
||||
#include <QSet>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
ContentNotEditableIndicator::ContentNotEditableIndicator(LayerItem *layerItem)
|
||||
@@ -68,6 +70,24 @@ void ContentNotEditableIndicator::setItems(const QList<FormEditorItem*> &itemLis
|
||||
addAddiationEntries(itemList);
|
||||
}
|
||||
|
||||
void ContentNotEditableIndicator::updateItems(const QList<FormEditorItem *> &itemList)
|
||||
{
|
||||
QSet<FormEditorItem*> affectedFormEditorItemItems;
|
||||
affectedFormEditorItemItems.unite(itemList.toSet());
|
||||
foreach (FormEditorItem *formEditorItem, itemList)
|
||||
affectedFormEditorItemItems.unite(formEditorItem->offspringFormEditorItems().toSet());
|
||||
|
||||
foreach (const EntryPair &entryPair, m_entryList) {
|
||||
foreach (FormEditorItem *formEditorItem, 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)
|
||||
{
|
||||
foreach (FormEditorItem *formEditorItem, itemList) {
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
void clear();
|
||||
|
||||
void setItems(const QList<FormEditorItem*> &itemList);
|
||||
void updateItems(const QList<FormEditorItem*> &itemList);
|
||||
|
||||
protected:
|
||||
void addAddiationEntries(const QList<FormEditorItem*> &itemList);
|
||||
|
||||
@@ -289,6 +289,20 @@ void FormEditorItem::paintComponentContentVisualisation(QPainter *painter, const
|
||||
painter->fillRect(clippinRectangle, Qt::BDiagPattern);
|
||||
}
|
||||
|
||||
QList<FormEditorItem *> FormEditorItem::offspringFormEditorItemsRecursive(const FormEditorItem *formEditorItem) const
|
||||
{
|
||||
QList<FormEditorItem*> formEditorItemList;
|
||||
|
||||
foreach (QGraphicsItem *item, formEditorItem->childItems()) {
|
||||
FormEditorItem *formEditorItem = fromQGraphicsItem(item);
|
||||
if (formEditorItem) {
|
||||
formEditorItemList.append(formEditorItem);
|
||||
}
|
||||
}
|
||||
|
||||
return formEditorItemList;
|
||||
}
|
||||
|
||||
void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
||||
{
|
||||
if (!painter->isActive())
|
||||
@@ -394,6 +408,11 @@ QList<FormEditorItem*> FormEditorItem::childFormEditorItems() const
|
||||
return formEditorItemList;
|
||||
}
|
||||
|
||||
QList<FormEditorItem *> FormEditorItem::offspringFormEditorItems() const
|
||||
{
|
||||
return offspringFormEditorItemsRecursive(this);
|
||||
}
|
||||
|
||||
bool FormEditorItem::isContainer() const
|
||||
{
|
||||
NodeMetaInfo nodeMetaInfo = qmlItemNode().modelNode().metaInfo();
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
SnapLineMap rightSnappingOffsets() const;
|
||||
|
||||
QList<FormEditorItem*> childFormEditorItems() const;
|
||||
QList<FormEditorItem*> offspringFormEditorItems() const;
|
||||
|
||||
FormEditorScene *scene() const;
|
||||
FormEditorItem *parentItem() const;
|
||||
|
||||
@@ -114,6 +116,7 @@ protected:
|
||||
void paintBoundingRect(QPainter *painter) const;
|
||||
void paintPlaceHolderForInvisbleItem(QPainter *painter) const;
|
||||
void paintComponentContentVisualisation(QPainter *painter, const QRectF &clippinRectangle) const;
|
||||
QList<FormEditorItem*> offspringFormEditorItemsRecursive(const FormEditorItem *formEditorItem) const;
|
||||
|
||||
private: // functions
|
||||
FormEditorItem(const QmlItemNode &qmlItemNode, FormEditorScene* scene);
|
||||
|
||||
@@ -401,6 +401,7 @@ void MoveTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
|
||||
m_resizeIndicator.updateItems(selectedItemList);
|
||||
m_anchorIndicator.updateItems(selectedItemList);
|
||||
m_bindingIndicator.updateItems(selectedItemList);
|
||||
m_contentNotEditableIndicator.updateItems(selectedItemList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -271,6 +271,7 @@ void SelectionTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemLis
|
||||
m_resizeIndicator.updateItems(selectedItemList);
|
||||
m_anchorIndicator.updateItems(selectedItemList);
|
||||
m_bindingIndicator.updateItems(selectedItemList);
|
||||
m_contentNotEditableIndicator.updateItems(selectedItemList);
|
||||
}
|
||||
|
||||
void SelectionTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
|
||||
|
||||
Reference in New Issue
Block a user