Unsolved Wave example as splashscreen
-
Hi to all,
I'd like to use the Wave example (https://doc.qt.io/qt-5.9/qt3d-wave-example.html) as splascreen of my application.Can someone give me some advice how to add a logo (png or svg file) over the wave window?
It could be a stupid question but I'm a newbie in QML, usually I use Qt C++.
Thank you. -
@addebito Hey,
Just add a Rectangle {} with a Image{} that contains your logo, you can just adjust the z property of the rectangle to make it "On top"
Note that if you are using the example as a splash screen you must abide by the copyright notice inside and that everyone using qt will know you cheated :p..
-
@MEMekaniske said in Wave example as splashscreen:
@addebito Hey,
Just add a Rectangle {} with a Image{} that contains your logo, you can just adjust the z property of the rectangle to make it "On top". . .
This was the first thing I tried, I could not make my image show. An interesting problem.
-
I'm just about to catch a train, so have to run, but if no one answers by the time I'm back I'll check what I did for my HUD interface, though I'm pretty sure I just added a rect and my qml items inside that rect.
-
@Markkyboy I'm back and just checked the project I made for testing QML 3D..
I'm not using Enteties as in the wave example but should be sort of the same solution there as in mine I guess.
View3D { renderMode: View3D.Underlay }
If the enteties renderer does not have any settings that achieve the same thing, then you could just use a free software and create a model with the logo as a texture :)
-
For Scene3D as used in wave, you can set
compositingMode : Scene3D.Underlay
-
Hi @MEMekaniske,
thank you for your suggestions but as I wrote I'm really a newbie in QML...
Where I've to write a Rectangle with the Image?
Where I've to set the "compositingMode : Scene3D.Underlay"?I've added the "compositingMode : Scene3D.Underlay" in the main.qml but the compiler say :
"Invalid property name "compositingMode ". (M16)"Google in this case doesn't help me a lot...
Thank you. -
@addebito I would have thought that this would work..
//Changed and added some import statements and added Scene3D{} and Rectangle{Text{}} to main.qml //Text should be Image for your purpose.. import QtQuick 2.14 as QQ2 import Qt3D.Core 2.14 import Qt3D.Render 2.14 import Qt3D.Input 2.14 import Qt3D.Extras 2.14 import QtQuick.Scene3D 2.14 Entity { id: root KeyboardDevice { id: keyboard1 } Scene3D { id: scene3d anchors.fill: parent anchors.margins: 10 focus: true cameraAspectRatioMode: Scene3D.AutomaticAspectRatio; entity: wave; compositingMode:Scene3D.Underlay; } QQ2.Rectangle { width:100; height:20; anchors.centerIn:parent; QQ2.Text { id: name text: qsTr("Hello Sir") } } //--- the rest of the code left untouched
But I just tested it, seems that it won't work because of the example's structure..
Scene3D and compositingMode is ok, but can't add rectangle/text to it.qrc:/main.qml:71:9: Cannot assign object of type "QQ2.Rectangle" to property of type "Qt3DCore::QEntity*" as the former is neither the same as the latter nor a sub-class of it.
If you write a standard window application, then implement the Qt3D example into that, then you should be able to use the normal Qt Quick items (rectangle/image/text etc) by adding them outside of the Entity/Scene3D blocks.. Probably not the easiest thing to start with being new to Qt/QML but when done you should have learned a alot :)
Basicly you need a application with a standard application type window, then add the root entity, containing camera, wave, background etc to Scene3D with entity: root, so it would be more like:
Window { id:window; height:480; width:640; QQ2.Rectangle { width:100; height:20; anchors.centerIn:parent; QQ2.Text { id: name text: qsTr("Hello Sir") } } Scene3D { id: scene3d anchors.fill: window anchors.margins: 10 focus: true cameraAspectRatioMode: Scene3D.AutomaticAspectRatio; entity: root; compositingMode:Scene3D.Underlay; } Entity { id: root KeyboardDevice { id: keyboard1 } //the rest of the code... } }
Also, main.cpp is now set to load the entity as the window, so you must also modify main.cpp correctly so it can load the standard application window and not 3DQuickQindow as it does now..
Maybe someone else knows an easier and/or better way, but that's how I would go about trying to solve it..
Hope you manage to get this running.. Would not be any learning for you if I wrote everything so just try and fail and try again! :)