QmlDesigner: Add navigator tooltip for 3D Components with Node root

This enables showing preview tooltip for all imported 3D models.

Also moved the preview image handling out of the model and into
NodeInstanceView, where it fits more naturally.

Change-Id: I48135d06aa8d9313525dae618e22692563da78fd
Fixes: QDS-2807
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-09-22 11:30:05 +03:00
parent 762addfbd0
commit 31ec38dba5
16 changed files with 324 additions and 189 deletions

View File

@@ -41,6 +41,7 @@ Item {
property var materialViewComponent
property var effectViewComponent
property var modelViewComponent
property var nodeViewComponent
property bool ready: false
@@ -65,6 +66,8 @@ Item {
createViewForEffect(obj);
else if (obj instanceof Model)
createViewForModel(obj);
else if (obj instanceof Node)
createViewForNode(obj);
previewObject = obj;
}
@@ -99,10 +102,20 @@ Item {
view = modelViewComponent.createObject(viewRect, {"sourceModel": model});
}
function createViewForNode(node)
{
if (!nodeViewComponent)
nodeViewComponent = Qt.createComponent("NodeNodeView.qml");
// Always recreate the view to ensure node is up to date
if (nodeViewComponent.status === Component.Ready)
view = nodeViewComponent.createObject(viewRect, {"importScene": node});
}
function afterRender()
{
if (previewObject instanceof Model) {
view.fitModel();
if (previewObject instanceof Node) {
view.fitToViewPort();
ready = view.ready;
} else {
ready = true;