QmlDesigner: Add lock feature support to 3D editor

Added lock feature support for 3D editor. Also refactored the hide
support, since the two use largely similar logic.

Task-number: QDS-2915
Change-Id: I627848f3a3a73881427a03aeec6793fd26a1885a
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2020-10-09 11:14:14 +02:00
committed by Miikka Heikkinen
parent 3d78fef4ef
commit f2883c19b1
16 changed files with 343 additions and 106 deletions

View File

@@ -102,14 +102,21 @@ void Edit3DCanvas::resizeEvent(QResizeEvent *e)
void Edit3DCanvas::dragEnterEvent(QDragEnterEvent *e)
{
QByteArray data = e->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"));
if (!data.isEmpty()) {
QDataStream stream(data);
stream >> m_itemLibraryEntry;
bool canDrop = NodeHints::fromItemLibraryEntry(m_itemLibraryEntry).canBeDroppedInView3D();
// Block all drags if scene root node is locked
ModelNode node;
if (m_parent->view()->hasModelNodeForInternalId(m_activeScene))
node = m_parent->view()->modelNodeForInternalId(m_activeScene);
if (canDrop)
e->accept();
// Allow drop when there is no valid active scene, as the drop goes under the root node of
// the document in that case.
if (!node.isValid() || !ModelNode::isThisOrAncestorLocked(node)) {
QByteArray data = e->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"));
if (!data.isEmpty()) {
QDataStream stream(data);
stream >> m_itemLibraryEntry;
if (NodeHints::fromItemLibraryEntry(m_itemLibraryEntry).canBeDroppedInView3D())
e->accept();
}
}
}