forked from qt-creator/qt-creator
QmlDesigner: Fix resize handle shown at start
Task-number: QTCREATORBUG-10374 Change-Id: I68ec998ad156a74d37e0321e1538b0936fded8da Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
50e32a9252
commit
9ae3e461ce
@@ -190,6 +190,18 @@ FormEditorItem* AbstractFormEditorTool::topFormEditorItemWithRootItem(const QLis
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<FormEditorItem *> AbstractFormEditorTool::filterSelectedModelNodes(const QList<FormEditorItem *> &itemList) const
|
||||
{
|
||||
QList<FormEditorItem *> filteredItemList;
|
||||
|
||||
foreach (FormEditorItem *item, itemList) {
|
||||
if (view()->isSelectedModelNode(item->qmlItemNode()))
|
||||
filteredItemList.append(item);
|
||||
}
|
||||
|
||||
return filteredItemList;
|
||||
}
|
||||
|
||||
void AbstractFormEditorTool::dropEvent(QGraphicsSceneDragDropEvent * /* event */)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@ public:
|
||||
static FormEditorItem* topFormEditorItem(const QList<QGraphicsItem*> &itemList);
|
||||
static FormEditorItem* topFormEditorItemWithRootItem(const QList<QGraphicsItem*> &itemList);
|
||||
|
||||
QList<FormEditorItem*> filterSelectedModelNodes(const QList<FormEditorItem*> &itemList) const;
|
||||
|
||||
protected:
|
||||
virtual void selectedItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
|
||||
virtual void showContextMenu(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
@@ -395,10 +395,12 @@ QList<FormEditorItem*> MoveTool::movingItems(const QList<FormEditorItem*> &selec
|
||||
|
||||
void MoveTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
|
||||
{
|
||||
m_selectionIndicator.updateItems(itemList);
|
||||
m_resizeIndicator.updateItems(itemList);
|
||||
m_anchorIndicator.updateItems(itemList);
|
||||
m_bindingIndicator.updateItems(itemList);
|
||||
const QList<FormEditorItem*> selectedItemList = filterSelectedModelNodes(itemList);
|
||||
|
||||
m_selectionIndicator.updateItems(selectedItemList);
|
||||
m_resizeIndicator.updateItems(selectedItemList);
|
||||
m_anchorIndicator.updateItems(selectedItemList);
|
||||
m_bindingIndicator.updateItems(selectedItemList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -192,9 +192,11 @@ void ResizeTool::clear()
|
||||
|
||||
void ResizeTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
|
||||
{
|
||||
m_selectionIndicator.updateItems(itemList);
|
||||
m_resizeIndicator.updateItems(itemList);
|
||||
m_anchorIndicator.updateItems(itemList);
|
||||
const QList<FormEditorItem*> selectedItemList = filterSelectedModelNodes(itemList);
|
||||
|
||||
m_selectionIndicator.updateItems(selectedItemList);
|
||||
m_resizeIndicator.updateItems(selectedItemList);
|
||||
m_anchorIndicator.updateItems(selectedItemList);
|
||||
}
|
||||
|
||||
void ResizeTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
|
||||
|
||||
@@ -265,10 +265,12 @@ void SelectionTool::selectedItemsChanged(const QList<FormEditorItem*> &itemList)
|
||||
|
||||
void SelectionTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
|
||||
{
|
||||
m_selectionIndicator.updateItems(itemList);
|
||||
m_resizeIndicator.updateItems(itemList);
|
||||
m_anchorIndicator.updateItems(itemList);
|
||||
m_bindingIndicator.updateItems(itemList);
|
||||
const QList<FormEditorItem*> selectedItemList = filterSelectedModelNodes(itemList);
|
||||
|
||||
m_selectionIndicator.updateItems(selectedItemList);
|
||||
m_resizeIndicator.updateItems(selectedItemList);
|
||||
m_anchorIndicator.updateItems(selectedItemList);
|
||||
m_bindingIndicator.updateItems(selectedItemList);
|
||||
}
|
||||
|
||||
void SelectionTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
|
||||
|
||||
@@ -152,6 +152,7 @@ public:
|
||||
void clearSelectedModelNodes();
|
||||
bool hasSelectedModelNodes() const;
|
||||
bool hasSingleSelectedModelNode() const;
|
||||
bool isSelectedModelNode(const ModelNode &modelNode) const;
|
||||
|
||||
QList<ModelNode> selectedModelNodes() const;
|
||||
ModelNode firstSelectedModelNode() const;
|
||||
|
||||
@@ -293,6 +293,11 @@ bool AbstractView::hasSingleSelectedModelNode() const
|
||||
return model()->d->selectedNodes().count() == 1;
|
||||
}
|
||||
|
||||
bool AbstractView::isSelectedModelNode(const ModelNode &modelNode) const
|
||||
{
|
||||
return model()->d->selectedNodes().contains(modelNode.internalNode());
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the list of nodes to the actual selected nodes. Returns a list of the
|
||||
selected nodes.
|
||||
|
||||
Reference in New Issue
Block a user