Commit ff4457bb authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Prepare for other layout items



Change-Id: I831e68877eb3d785b4bbb99db002ab8e42158d75
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 40b62e1c
......@@ -81,8 +81,8 @@ QString InformationContainer::nameAsString() const
return QLatin1String("PenWidth");
case Position:
return QLatin1String("Position");
case IsInPositioner:
return QLatin1String("IsInPositioner");
case IsInLayoutable:
return QLatin1String("IsInLayoutable");
case SceneTransform:
return QLatin1String("SceneTransform");
case IsResizable:
......
......@@ -47,7 +47,7 @@ enum InformationName
InstanceTypeForProperty,
PenWidth,
Position,
IsInPositioner,
IsInLayoutable,
SceneTransform,
IsResizable,
IsMovable,
......
......@@ -350,8 +350,8 @@ void GraphicalNodeInstance::setPropertyVariant(const PropertyName &name, const Q
refresh();
if (isInPositioner())
parentInstance()->refreshPositioner();
if (isInLayoutable())
parentInstance()->refreshLayoutable();
}
void GraphicalNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression)
......@@ -365,8 +365,8 @@ void GraphicalNodeInstance::setPropertyBinding(const PropertyName &name, const Q
refresh();
if (isInPositioner())
parentInstance()->refreshPositioner();
if (isInLayoutable())
parentInstance()->refreshLayoutable();
}
QVariant GraphicalNodeInstance::property(const PropertyName &name) const
......@@ -423,8 +423,8 @@ void GraphicalNodeInstance::resetProperty(const PropertyName &name)
quickItem()->update();
if (isInPositioner())
parentInstance()->refreshPositioner();
if (isInLayoutable())
parentInstance()->refreshLayoutable();
}
......
......@@ -892,7 +892,7 @@ static QVector<InformationContainer> createInformationVector(const QList<ServerN
informationVector.append(InformationContainer(instance.instanceId(), HasContent, instance.hasContent()));
informationVector.append(InformationContainer(instance.instanceId(), IsMovable, instance.isMovable()));
informationVector.append(InformationContainer(instance.instanceId(), IsResizable, instance.isResizable()));
informationVector.append(InformationContainer(instance.instanceId(), IsInPositioner, instance.isInPositioner()));
informationVector.append(InformationContainer(instance.instanceId(), IsInLayoutable, instance.isInLayoutable()));
informationVector.append(InformationContainer(instance.instanceId(), PenWidth, instance.penWidth()));
informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredByChildren, instance.isAnchoredByChildren()));
informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredBySibling, instance.isAnchoredBySibling()));
......
......@@ -73,7 +73,7 @@ ObjectNodeInstance::ObjectNodeInstance(QObject *object)
m_deleteHeldInstance(true),
m_object(object),
m_metaObject(0),
m_isInPositioner(false)
m_isInLayoutable(false)
{
}
......@@ -204,6 +204,11 @@ bool ObjectNodeInstance::isGraphical() const
return false;
}
bool ObjectNodeInstance::isLayoutable() const
{
return true;
}
bool ObjectNodeInstance::equalGraphicsItem(QGraphicsItem * /*item*/) const
{
return false;
......@@ -1033,17 +1038,17 @@ bool ObjectNodeInstance::isMovable() const
return false;
}
bool ObjectNodeInstance::isInPositioner() const
bool ObjectNodeInstance::isInLayoutable() const
{
return m_isInPositioner;
return m_isInLayoutable;
}
void ObjectNodeInstance::setInPositioner(bool isInPositioner)
void ObjectNodeInstance::setInLayoutable(bool isInLayoutable)
{
m_isInPositioner = isInPositioner;
m_isInLayoutable = isInLayoutable;
}
void ObjectNodeInstance::refreshPositioner()
void ObjectNodeInstance::refreshLayoutable()
{
}
......
......@@ -99,6 +99,7 @@ public:
virtual bool isQuickItem() const;
virtual bool isQuickWindow() const;
virtual bool isGraphical() const;
virtual bool isLayoutable() const;
virtual bool equalGraphicsItem(QGraphicsItem *item) const;
......@@ -155,9 +156,9 @@ public:
virtual bool hasContent() const;
virtual bool isResizable() const;
virtual bool isMovable() const;
bool isInPositioner() const;
void setInPositioner(bool isInPositioner);
virtual void refreshPositioner();
bool isInLayoutable() const;
void setInLayoutable(bool isInLayoutable);
virtual void refreshLayoutable();
bool hasBindingForProperty(const PropertyName &name, bool *hasChanged = 0) const;
......@@ -204,7 +205,7 @@ private:
QPointer<QObject> m_object;
NodeInstanceMetaObject *m_metaObject;
NodeInstanceSignalSpy m_signalSpy;
bool m_isInPositioner;
bool m_isInLayoutable;
};
} // namespace Internal
......
......@@ -42,6 +42,11 @@ bool PositionerNodeInstance::isPositioner() const
return true;
}
bool PositionerNodeInstance::isLayoutable() const
{
return true;
}
bool PositionerNodeInstance::isResizable() const
{
return true;
......@@ -87,7 +92,7 @@ QQuickBasePositioner *PositionerNodeInstance::positioner() const
return static_cast<QQuickBasePositioner*>(object());
}
void PositionerNodeInstance::refreshPositioner()
void PositionerNodeInstance::refreshLayoutable()
{
bool success = QMetaObject::invokeMethod(positioner(), "prePositioning");
Q_ASSERT(success);
......
......@@ -51,10 +51,11 @@ public:
void setPropertyBinding(const PropertyName &name, const QString &expression) Q_DECL_OVERRIDE;
bool isPositioner() const Q_DECL_OVERRIDE;
bool isLayoutable() const Q_DECL_OVERRIDE;
bool isResizable() const Q_DECL_OVERRIDE;
void refreshPositioner() Q_DECL_OVERRIDE;
void refreshLayoutable() Q_DECL_OVERRIDE;
protected:
PositionerNodeInstance(QQuickBasePositioner *item);
......
......@@ -131,14 +131,14 @@ void QuickItemNodeInstance::setResizable(bool resizable)
void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty)
{
if (oldParentInstance && oldParentInstance->isPositioner()) {
setInPositioner(false);
setInLayoutable(false);
setMovable(true);
}
ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
if (newParentInstance && newParentInstance->isPositioner()) {
setInPositioner(true);
setInLayoutable(true);
setMovable(false);
}
......@@ -153,8 +153,8 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen
refresh();
DesignerSupport::updateDirtyNode(quickItem());
if (parentInstance() && isInPositioner())
parentInstance()->refreshPositioner();
if (parentInstance() && isInLayoutable())
parentInstance()->refreshLayoutable();
}
bool QuickItemNodeInstance::isAnchoredBySibling() const
......
......@@ -408,9 +408,9 @@ bool ServerNodeInstance::isMovable() const
return m_nodeInstance->isMovable();
}
bool ServerNodeInstance::isInPositioner() const
bool ServerNodeInstance::isInLayoutable() const
{
return m_nodeInstance->isInPositioner();
return m_nodeInstance->isInLayoutable();
}
bool ServerNodeInstance::hasAnchor(const PropertyName &name) const
......
......@@ -130,7 +130,7 @@ public:
bool hasContent() const;
bool isResizable() const;
bool isMovable() const;
bool isInPositioner() const;
bool isInLayoutable() const;
bool isSubclassOf(const QString &superTypeName) const;
bool isRootNodeInstance() const;
......
......@@ -886,7 +886,7 @@ static QVector<InformationContainer> createInformationVector(const QList<ServerN
informationVector.append(InformationContainer(instance.instanceId(), HasContent, instance.hasContent()));
informationVector.append(InformationContainer(instance.instanceId(), IsMovable, instance.isMovable()));
informationVector.append(InformationContainer(instance.instanceId(), IsResizable, instance.isResizable()));
informationVector.append(InformationContainer(instance.instanceId(), IsInPositioner, instance.isInPositioner()));
informationVector.append(InformationContainer(instance.instanceId(), IsInLayoutable, instance.isInLayoutable()));
informationVector.append(InformationContainer(instance.instanceId(), PenWidth, instance.penWidth()));
informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredByChildren, instance.isAnchoredByChildren()));
informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredBySibling, instance.isAnchoredBySibling()));
......
......@@ -379,7 +379,7 @@ bool ServerNodeInstance::isMovable() const
return m_nodeInstance->isMovable();
}
bool ServerNodeInstance::isInPositioner() const
bool ServerNodeInstance::isInLayoutable() const
{
return m_nodeInstance->isInPositioner();
}
......
......@@ -127,7 +127,7 @@ public:
bool hasContent() const;
bool isResizable() const;
bool isMovable() const;
bool isInPositioner() const;
bool isInLayoutable() const;
bool isSubclassOf(const QString &superTypeName) const;
bool isRootNodeInstance() const;
......
......@@ -144,7 +144,7 @@ static inline bool itemsHaveSameParent(const QList<ModelNode> &siblingList)
QmlItemNode currentParent = currentItem.instanceParent().toQmlItemNode();
if (!currentParent.isValid())
return false;
if (currentItem.instanceIsInPositioner())
if (currentItem.instanceIsInLayoutable())
return false;
if (currentParent != parent)
return false;
......
......@@ -103,7 +103,7 @@ bool AbstractFormEditorTool::topSelectedItemIsMovable(const QList<QGraphicsItem*
if (formEditorItem
&& selectedNodes.contains(formEditorItem->qmlItemNode())
&& formEditorItem->qmlItemNode().instanceIsMovable()
&& !formEditorItem->qmlItemNode().instanceIsInPositioner()
&& !formEditorItem->qmlItemNode().instanceIsInLayoutable()
&& (formEditorItem->qmlItemNode().hasShowContent()))
return true;
}
......@@ -113,7 +113,7 @@ bool AbstractFormEditorTool::topSelectedItemIsMovable(const QList<QGraphicsItem*
if (formEditorItem
&& formEditorItem->qmlItemNode().isValid()
&& formEditorItem->qmlItemNode().instanceIsMovable()
&& !formEditorItem->qmlItemNode().instanceIsInPositioner()
&& !formEditorItem->qmlItemNode().instanceIsInLayoutable()
&& selectedNodes.contains(formEditorItem->qmlItemNode()))
return true;
}
......
......@@ -634,7 +634,7 @@ bool FormEditorView::isMoveToolAvailable() const
{
if (selectedQmlItemNodes().count() == 1)
return selectedQmlItemNodes().first().instanceIsMovable() &&
!selectedQmlItemNodes().first().instanceIsInPositioner();
!selectedQmlItemNodes().first().instanceIsInLayoutable();
return true;
}
......
......@@ -367,7 +367,7 @@ QList<FormEditorItem*> movalbeItems(const QList<FormEditorItem*> &itemList)
QMutableListIterator<FormEditorItem*> listIterator(filteredItemList);
while (listIterator.hasNext()) {
FormEditorItem *item = listIterator.next();
if (!item->qmlItemNode().isValid() || !item->qmlItemNode().instanceIsMovable() || item->qmlItemNode().instanceIsInPositioner())
if (!item->qmlItemNode().isValid() || !item->qmlItemNode().instanceIsMovable() || item->qmlItemNode().instanceIsInLayoutable())
listIterator.remove();
}
......
......@@ -75,7 +75,7 @@ void ResizeIndicator::setItems(const QList<FormEditorItem*> &itemList)
&& item->qmlItemNode().isValid()
&& item->qmlItemNode().instanceIsResizable()
&& !item->qmlItemNode().instanceHasRotationTransform()
&& !item->qmlItemNode().instanceIsInPositioner()) {
&& !item->qmlItemNode().instanceIsInLayoutable()) {
ResizeController controller(m_layerItem, item);
m_itemControllerHash.insert(item, controller);
}
......
......@@ -104,7 +104,7 @@ void RubberBandSelectionManipulator::select(SelectionType selectionType)
&& formEditorItem->qmlItemNode().isValid()
&& m_beginFormEditorItem->childItems().contains(formEditorItem)
&& formEditorItem->qmlItemNode().instanceIsMovable()
&& !formEditorItem->qmlItemNode().instanceIsInPositioner())
&& !formEditorItem->qmlItemNode().instanceIsInLayoutable())
{
newNodeList.append(formEditorItem->qmlItemNode());
}
......@@ -113,7 +113,7 @@ void RubberBandSelectionManipulator::select(SelectionType selectionType)
if (newNodeList.isEmpty()
&& m_beginFormEditorItem->qmlItemNode().isValid()
&& m_beginFormEditorItem->qmlItemNode().instanceIsMovable()
&& !m_beginFormEditorItem->qmlItemNode().instanceIsInPositioner())
&& !m_beginFormEditorItem->qmlItemNode().instanceIsInLayoutable())
newNodeList.append(m_beginFormEditorItem->qmlItemNode());
QList<QmlItemNode> nodeList;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment