diff options
Diffstat (limited to 'share/qtcreator')
5 files changed, 23 insertions, 9 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp index aa7c826065..6c851e3a43 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp +++ b/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp @@ -29,14 +29,16 @@ namespace QmlDesigner { -Drop3DLibraryItemCommand::Drop3DLibraryItemCommand(const QByteArray &itemData) - : m_itemData(itemData) +Drop3DLibraryItemCommand::Drop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId) + : m_itemData(itemData), + m_sceneRootId(sceneRootId) { } QDataStream &operator<<(QDataStream &out, const Drop3DLibraryItemCommand &command) { out << command.itemData(); + out << command.sceneRootId(); return out; } @@ -44,13 +46,14 @@ QDataStream &operator<<(QDataStream &out, const Drop3DLibraryItemCommand &comman QDataStream &operator>>(QDataStream &in, Drop3DLibraryItemCommand &command) { in >> command.m_itemData; + in >> command.m_sceneRootId; return in; } bool operator==(const Drop3DLibraryItemCommand &first, const Drop3DLibraryItemCommand &second) { - return first.m_itemData == second.m_itemData; + return first.m_itemData == second.m_itemData && first.m_sceneRootId == second.m_sceneRootId; } } // namespace QmlDesigner diff --git a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h b/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h index 1aa11a85f9..4bc36e1ebd 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h +++ b/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h @@ -41,13 +41,15 @@ class Drop3DLibraryItemCommand const Drop3DLibraryItemCommand &second); public: - explicit Drop3DLibraryItemCommand(const QByteArray &itemData); + explicit Drop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId); Drop3DLibraryItemCommand() = default; QByteArray itemData() const { return m_itemData; } + qint32 sceneRootId() const { return m_sceneRootId; } private: QByteArray m_itemData; + qint32 m_sceneRootId; }; QDataStream &operator<<(QDataStream &out, const Drop3DLibraryItemCommand &command); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index 5f277bf6bb..d772844b3c 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -1180,9 +1180,10 @@ ChangeSelectionCommand NodeInstanceServer::createChangeSelectionCommand(const QL return ChangeSelectionCommand(idVector); } -Drop3DLibraryItemCommand NodeInstanceServer::createDrop3DLibraryItemCommand(const QByteArray &itemData) +Drop3DLibraryItemCommand NodeInstanceServer::createDrop3DLibraryItemCommand(const QByteArray &itemData, + qint32 sceneRootId) { - return Drop3DLibraryItemCommand(itemData); + return Drop3DLibraryItemCommand(itemData, sceneRootId); } ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVector<InstancePropertyPair> &propertyList) const diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index 861b674af9..1c3ee59791 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -183,7 +183,7 @@ protected: ChildrenChangedCommand createChildrenChangedCommand(const ServerNodeInstance &parentInstance, const QList<ServerNodeInstance> &instanceList) const; ComponentCompletedCommand createComponentCompletedCommand(const QList<ServerNodeInstance> &instanceList); ChangeSelectionCommand createChangeSelectionCommand(const QList<ServerNodeInstance> &instanceList); - Drop3DLibraryItemCommand createDrop3DLibraryItemCommand(const QByteArray &itemData); + Drop3DLibraryItemCommand createDrop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId); void addChangedProperty(const InstancePropertyPair &property); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 6e332f8b63..08cd930a57 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -109,8 +109,16 @@ bool Qt5InformationNodeInstanceServer::eventFilter(QObject *, QEvent *event) case QEvent::Drop: { QDropEvent *dropEvent = static_cast<QDropEvent *>(event); QByteArray data = dropEvent->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo")); - if (!data.isEmpty()) - nodeInstanceClient()->library3DItemDropped(createDrop3DLibraryItemCommand(data)); + if (!data.isEmpty()) { + ServerNodeInstance sceneInstance; + if (hasInstanceForObject(m_active3DScene)) + sceneInstance = instanceForObject(m_active3DScene); + else if (hasInstanceForObject(m_active3DView)) + sceneInstance = instanceForObject(m_active3DView); + + nodeInstanceClient()->library3DItemDropped(createDrop3DLibraryItemCommand( + data, sceneInstance.instanceId())); + } } break; |