Commit 73a63707 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.NavigatorView: Do not set a position for new items

If items are dragged into the navigator we should not set the position
to 0,0 expliticly, because this breaks layouts.

Change-Id: I6e7cd130390ab68d13904d379a35dc4fa4337231
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent ecf96013
......@@ -718,7 +718,7 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
if (foundTarget) {
ItemLibraryEntry itemLibraryEntry = itemLibraryEntryFromData(mimeData->data("application/vnd.bauhaus.itemlibraryinfo"));
QmlItemNode newQmlItemNode = QmlItemNode::createQmlItemNode(m_view, itemLibraryEntry, QPointF(0., 0.), targetProperty);
QmlItemNode newQmlItemNode = QmlItemNode::createQmlItemNode(m_view, itemLibraryEntry, QPointF(), targetProperty);
if (newQmlItemNode.isValid() && targetProperty.isNodeListProperty()) {
QList<ModelNode> newModelNodeList;
......@@ -739,7 +739,7 @@ void NavigatorTreeModel::handleItemLibraryImageDrop(const QMimeData *mimeData, i
if (foundTarget) {
QString imageFileName = QString::fromUtf8(mimeData->data("application/vnd.bauhaus.libraryresource"));
QmlItemNode newQmlItemNode = QmlItemNode::createQmlItemNodeFromImage(m_view, imageFileName, QPointF(0., 0.), targetProperty);
QmlItemNode newQmlItemNode = QmlItemNode::createQmlItemNodeFromImage(m_view, imageFileName, QPointF(), targetProperty);
if (newQmlItemNode.isValid()) {
QList<ModelNode> newModelNodeList;
......
......@@ -117,8 +117,10 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibrary
QList<PropertyBindingEntry> propertyBindingList;
if (itemLibraryEntry.qmlSource().isEmpty()) {
QList<QPair<PropertyName, QVariant> > propertyPairList;
propertyPairList.append(qMakePair(PropertyName("x"), QVariant(qRound(position.x()))));
propertyPairList.append(qMakePair(PropertyName("y"), QVariant(qRound(position.y()))));
if (!position.isNull()) {
propertyPairList.append(qMakePair(PropertyName("x"), QVariant(qRound(position.x()))));
propertyPairList.append(qMakePair(PropertyName("y"), QVariant(qRound(position.y()))));
}
foreach (const PropertyContainer &property, itemLibraryEntry.properties()) {
if (property.type() == QStringLiteral("binding")) {
......
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