Commit 21372dc2 authored by Andy Nichols's avatar Andy Nichols

Add additional projection types to support steroscopic rendering

parent 39dc87a6
Pipeline #4557 passed with stage
in 4 minutes and 46 seconds
......@@ -41,7 +41,9 @@ Module {
name: "QSSGCameraProjectionMode"
values: {
"Perspective": 0,
"Orthographic": 1
"Orthographic": 1,
"Frustum": 2,
"Custom": 3
}
}
Property { name: "clipNear"; type: "float" }
......@@ -49,9 +51,12 @@ Module {
Property { name: "fieldOfView"; type: "float" }
Property { name: "isFieldOfViewHorizontal"; type: "bool" }
Property { name: "projectionMode"; type: "QSSGCameraProjectionMode" }
Property { name: "scaleMode"; type: "QSSGCameraScaleModes" }
Property { name: "scaleAnchor"; type: "QSSGCameraScaleAnchors" }
Property { name: "enableFrustumCulling"; type: "bool" }
Property { name: "frustumTop"; type: "float" }
Property { name: "frustumBottom"; type: "float" }
Property { name: "frustumRight"; type: "float" }
Property { name: "frustumLeft"; type: "float" }
Property { name: "customProjection"; type: "QMatrix4x4" }
Signal {
name: "clipNearChanged"
Parameter { name: "clipNear"; type: "float" }
......@@ -68,14 +73,6 @@ Module {
name: "isFieldOfViewHorizontalChanged"
Parameter { name: "isFieldOfViewHorizontal"; type: "bool" }
}
Signal {
name: "scaleModeChanged"
Parameter { name: "scaleMode"; type: "QSSGCameraScaleModes" }
}
Signal {
name: "scaleAnchorChanged"
Parameter { name: "scaleAnchor"; type: "QSSGCameraScaleAnchors" }
}
Signal {
name: "projectionModeChanged"
Parameter { name: "projectionMode"; type: "QSSGCameraProjectionMode" }
......@@ -84,6 +81,26 @@ Module {
name: "enableFrustumCullingChanged"
Parameter { name: "enableFrustumCulling"; type: "bool" }
}
Signal {
name: "frustumTopChanged"
Parameter { name: "frustumTop"; type: "float" }
}
Signal {
name: "frustumBottomChanged"
Parameter { name: "frustumBottom"; type: "float" }
}
Signal {
name: "frustumRightChanged"
Parameter { name: "frustumRight"; type: "float" }
}
Signal {
name: "frustumLeftChanged"
Parameter { name: "frustumLeft"; type: "float" }
}
Signal {
name: "customProjectionChanged"
Parameter { name: "customProjection"; type: "QMatrix4x4" }
}
Method {
name: "setClipNear"
Parameter { name: "clipNear"; type: "float" }
......@@ -100,14 +117,6 @@ Module {
name: "setIsFieldOfViewHorizontal"
Parameter { name: "isFieldOFViewHorizontal"; type: "bool" }
}
Method {
name: "setScaleMode"
Parameter { name: "scaleMode"; type: "QSSGCameraScaleModes" }
}
Method {
name: "setScaleAnchor"
Parameter { name: "scaleAnchor"; type: "QSSGCameraScaleAnchors" }
}
Method {
name: "setProjectionMode"
Parameter { name: "projectionMode"; type: "QSSGCameraProjectionMode" }
......@@ -116,6 +125,26 @@ Module {
name: "setEnableFrustumCulling"
Parameter { name: "enableFrustumCulling"; type: "bool" }
}
Method {
name: "setFrustumTop"
Parameter { name: "frustumTop"; type: "float" }
}
Method {
name: "setFrustumBottom"
Parameter { name: "frustumBottom"; type: "float" }
}
Method {
name: "setFrustumRight"
Parameter { name: "frustumRight"; type: "float" }
}
Method {
name: "setFrustumLeft"
Parameter { name: "frustumLeft"; type: "float" }
}
Method {
name: "setCustomProjection"
Parameter { name: "customProjection"; type: "QMatrix4x4" }
}
Method {
name: "worldToViewport"
type: "QVector3D"
......
This diff is collapsed.
......@@ -54,9 +54,15 @@ class Q_QUICK3D_EXPORT QQuick3DCamera : public QQuick3DNode
Q_PROPERTY(float fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged)
Q_PROPERTY(bool isFieldOfViewHorizontal READ isFieldOfViewHorizontal WRITE setIsFieldOfViewHorizontal NOTIFY isFieldOfViewHorizontalChanged)
Q_PROPERTY(QSSGCameraProjectionMode projectionMode READ projectionMode WRITE setProjectionMode NOTIFY projectionModeChanged)
Q_PROPERTY(QSSGCameraScaleModes scaleMode READ scaleMode WRITE setScaleMode NOTIFY scaleModeChanged)
Q_PROPERTY(QSSGCameraScaleAnchors scaleAnchor READ scaleAnchor WRITE setScaleAnchor NOTIFY scaleAnchorChanged)
Q_PROPERTY(bool enableFrustumCulling READ enableFrustumCulling WRITE setEnableFrustumCulling NOTIFY enableFrustumCullingChanged)
// Frustum Mode
Q_PROPERTY(float frustumTop READ frustumTop WRITE setFrustumTop NOTIFY frustumTopChanged)
Q_PROPERTY(float frustumBottom READ frustumBottom WRITE setFrustumBottom NOTIFY frustumBottomChanged)
Q_PROPERTY(float frustumRight READ frustumRight WRITE setFrustumRight NOTIFY frustumRightChanged)
Q_PROPERTY(float frustumLeft READ frustumRight WRITE setFrustumLeft NOTIFY frustumLeftChanged)
// Custom Mode
Q_PROPERTY(QMatrix4x4 customProjection READ customProjection WRITE setCustomProjection NOTIFY customProjectionChanged)
public:
enum QSSGCameraScaleModes {
......@@ -82,7 +88,9 @@ public:
enum QSSGCameraProjectionMode {
Perspective,
Orthographic
Orthographic,
Frustum,
Custom
};
Q_ENUM(QSSGCameraProjectionMode)
......@@ -103,26 +111,43 @@ public:
QSSGRenderCamera *getCameraNode() const;
float frustumTop() const;
float frustumBottom() const;
float frustumRight() const;
float frustumLeft() const;
QMatrix4x4 customProjection() const;
public Q_SLOTS:
void setClipNear(float clipNear);
void setClipFar(float clipFar);
void setFieldOfView(float fieldOfView);
void setIsFieldOfViewHorizontal(bool isFieldOFViewHorizontal);
void setScaleMode(QSSGCameraScaleModes scaleMode);
void setScaleAnchor(QSSGCameraScaleAnchors scaleAnchor);
void setProjectionMode(QSSGCameraProjectionMode projectionMode);
void setEnableFrustumCulling(bool enableFrustumCulling);
void setFrustumTop(float frustumTop);
void setFrustumBottom(float frustumBottom);
void setFrustumRight(float frustumRight);
void setFrustumLeft(float frustumLeft);
void setCustomProjection(QMatrix4x4 customProjection);
Q_SIGNALS:
void clipNearChanged(float clipNear);
void clipFarChanged(float clipFar);
void fieldOfViewChanged(float fieldOfView);
void isFieldOfViewHorizontalChanged(bool isFieldOfViewHorizontal);
void scaleModeChanged(QSSGCameraScaleModes scaleMode);
void scaleAnchorChanged(QSSGCameraScaleAnchors scaleAnchor);
void projectionModeChanged(QSSGCameraProjectionMode projectionMode);
void enableFrustumCullingChanged(bool enableFrustumCulling);
void frustumTopChanged(float frustumTop);
void frustumBottomChanged(float frustumBottom);
void frustumRightChanged(float frustumRight);
void frustumLeftChanged(float frustumLeft);
void customProjectionChanged(QMatrix4x4 customProjection);
protected:
QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
......@@ -130,13 +155,18 @@ private:
float m_clipNear = 10.0f;
float m_clipFar = 10000.0f;
float m_fieldOfView = 60.0f;
QSSGCameraScaleModes m_scaleMode = QSSGCameraScaleModes::Fit;
QSSGCameraScaleAnchors m_scaleAnchor = QSSGCameraScaleAnchors::Center;
bool m_isFieldOfViewHorizontal = false;
QSSGRenderCamera *m_cameraNode = nullptr;
QSSGCameraProjectionMode m_projectionMode = QSSGCameraProjectionMode::Perspective;
bool m_enableFrustumCulling = true;
float m_frustumTop = 0.0f;
float m_frustumBottom = 0.0f;
float m_frustumRight = 0.0f;
float m_frustumLeft = 0.0f;
QMatrix4x4 m_customProjection;
};
QT_END_NAMESPACE
......
......@@ -78,27 +78,6 @@ struct QSSGCuboidRect
struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderCamera : public QSSGRenderNode
{
enum class ScaleModes : quint8
{
Fit = 0,
SameSize,
FitHorizontal,
FitVertical,
};
enum class ScaleAnchors : quint8
{
Center = 0,
North,
NorthEast,
East,
SouthEast,
South,
SouthWest,
West,
NorthWest,
};
// Setting these variables should set dirty on the camera.
float clipNear;
float clipFar;
......@@ -106,16 +85,18 @@ struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderCamera : public QSSGRenderNode
float fov; // Radians
bool fovHorizontal;
float top = 0.0f;
float bottom = 0.0f;
float left = 0.0f;
float right = 0.0f;
QMatrix4x4 projection;
ScaleModes scaleMode;
ScaleAnchors scaleAnchor;
// Record some values from creating the projection matrix
// to use during mouse picking.
QVector2D frustumScale;
bool enableFrustumClipping;
QRectF previousInViewport;
QVector2D previousInDesignDimensions;
QSSGRenderCamera();
......@@ -127,15 +108,16 @@ struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderCamera : public QSSGRenderNode
// our global transform.
void lookAt(const QVector3D &inCameraPos, const QVector3D &inUpDir, const QVector3D &inTargetPos);
QSSGCameraGlobalCalculationResult calculateGlobalVariables(const QRectF &inViewport, const QVector2D &inDesignDimensions);
bool calculateProjection(const QRectF &inViewport, const QVector2D &inDesignDimensions);
bool computeFrustumOrtho(const QRectF &inViewport, const QVector2D &inDesignDimensions);
QSSGCameraGlobalCalculationResult calculateGlobalVariables(const QRectF &inViewport);
bool calculateProjection(const QRectF &inViewport);
bool computeFrustumOrtho(const QRectF &inViewport);
// Used when rendering the widgets in studio. This scales the widget when in orthographic
// mode in order to have
// constant size on screen regardless.
// Number is always greater than one
float getOrthographicScaleFactor(const QRectF &inViewport, const QVector2D &inDesignDimensions) const;
bool computeFrustumPerspective(const QRectF &inViewport, const QVector2D &inDesignDimensions);
float getOrthographicScaleFactor(const QRectF &inViewport) const;
bool computeFrustumPerspective(const QRectF &inViewport);
bool computeCustomFrustum(const QRectF &inViewport);
void calculateViewProjectionMatrix(QMatrix4x4 &outMatrix) const;
......@@ -148,7 +130,7 @@ struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderCamera : public QSSGRenderNode
// Return a normalized rect that describes the area the camera is rendering to.
// This takes into account the various camera properties (scale mode, scale anchor).
QSSGCuboidRect getCameraBounds(const QRectF &inViewport, const QVector2D &inDesignDimensions) const;
QSSGCuboidRect getCameraBounds(const QRectF &inViewport) const;
// Setup a camera VP projection for rendering offscreen.
static void setupOrthographicCameraForOffscreenRender(QSSGRenderTexture2D &inTexture, QMatrix4x4 &outVP);
......@@ -156,7 +138,7 @@ struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderCamera : public QSSGRenderNode
// Unproject a point (x,y) in viewport relative coordinates meaning
// left, bottom is 0,0 and values are increasing right,up respectively.
QSSGRenderRay unproject(const QVector2D &inLayerRelativeMouseCoords, const QRectF &inViewport, const QVector2D &inDesignDimensions) const;
QSSGRenderRay unproject(const QVector2D &inLayerRelativeMouseCoords, const QRectF &inViewport) const;
// Unproject a given coordinate to a 3d position that lies on the same camera
// plane as inGlobalPos.
......
......@@ -85,6 +85,8 @@ struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderNode : public QSSGRenderGraphObje
IgnoreParentTransform = 1 << 13,
LayerEnableDepthPrePass = 1 << 14, ///< True when we render a depth pass before
CameraDirty = 1 << 15, ///< True when the camera inheriting from this is dirty
CameraFrustumProjection = 1 << 16,
CameraCustomProjection = 1 << 17
};
Q_DECLARE_FLAGS(Flags, Flag)
......
......@@ -442,12 +442,7 @@ void QSSGRenderContextInterface::teardownRenderTarget()
theCamera.markDirty(QSSGRenderCamera::TransformDirtyFlag::TransformIsDirty);
theCamera.flags.setFlag(QSSGRenderCamera::Flag::Orthographic);
m_renderContext->setViewport(thePresentationViewport);
QVector2D theCameraDimensions((float)thePresentationViewport.width(), (float)thePresentationViewport.height());
theCamera.calculateGlobalVariables(QRect(0,
0,
(quint32)thePresentationViewport.width(),
(quint32)thePresentationViewport.height()),
theCameraDimensions);
theCamera.calculateGlobalVariables(QRectF(0, 0, thePresentationViewport.width(), thePresentationViewport.height()));
QMatrix4x4 theVP;
theCamera.calculateViewProjectionMatrix(theVP);
QSSGRenderNode theTempNode;
......
......@@ -247,7 +247,7 @@ struct QSSGPixelGraphicsRenderer : public QSSGPixelGraphicsRendererInterface
theCamera.clipFar = 10.0f;
theCamera.flags.setFlag(QSSGRenderCamera::Flag::Orthographic);
// Setup camera projection
theCamera.computeFrustumOrtho(theViewport, QVector2D(theViewport.width(), theViewport.height()));
theCamera.computeFrustumOrtho(theViewport);
// Translate such that 0, 0 is lower left of screen.
QRectF theIdealViewport = theViewport;
theIdealViewport.setX(theIdealViewport.x() - theViewport.width() / 2.0f);
......
......@@ -292,8 +292,7 @@ QSSGOption<QSSGCuboidRect> QSSGRendererImpl::cameraBounds(const QSSGRenderGraphO
if (!theLayer->usesOffscreenRenderer()) {
QSSGRenderCamera *theCamera = theLayer->camera;
if (theCamera)
return theCamera->getCameraBounds(theLayer->layerPrepResult->viewport(),
theLayer->layerPrepResult->presentationDesignDimensions());
return theCamera->getCameraBounds(theLayer->layerPrepResult->viewport());
}
}
return QSSGOption<QSSGCuboidRect>();
......@@ -305,7 +304,7 @@ void QSSGRendererImpl::drawScreenRect(QRectF inRect, const QVector3D &inColor)
theScreenCamera.markDirty(QSSGRenderCamera::TransformDirtyFlag::TransformIsDirty);
QRectF theViewport(m_context->viewport());
theScreenCamera.flags.setFlag(QSSGRenderCamera::Flag::Orthographic);
theScreenCamera.calculateGlobalVariables(theViewport, QVector2D(float(theViewport.width()), float(theViewport.height())));
theScreenCamera.calculateGlobalVariables(theViewport);
generateXYQuad();
if (!m_screenRectShader) {
QSSGRef<QSSGShaderProgramGeneratorInterface> theGenerator(getProgramGenerator());
......@@ -447,7 +446,7 @@ void QSSGRendererImpl::endFrame()
theCamera.markDirty(QSSGRenderCamera::TransformDirtyFlag::TransformIsDirty);
theCamera.flags.setFlag(QSSGRenderCamera::Flag::Orthographic);
QVector2D theTextureDims(float(theDetails.width), float(theDetails.height));
theCamera.calculateGlobalVariables(QRect(0, 0, theDetails.width, theDetails.height), theTextureDims);
theCamera.calculateGlobalVariables(QRectF(0, 0, theDetails.width, theDetails.height));
QMatrix4x4 theViewProj;
theCamera.calculateViewProjectionMatrix(theViewProj);
renderQuad(theTextureDims, theViewProj, *m_widgetTexture);
......@@ -911,8 +910,7 @@ QSSGScaleAndPosition QSSGRendererImpl::worldToPixelScaleFactor(const QSSGRenderC
if (inCamera.flags.testFlag(QSSGRenderCamera::Flag::Orthographic)) {
// There are situations where the camera can scale.
return QSSGScaleAndPosition(inWorldPoint,
inCamera.getOrthographicScaleFactor(inRenderData.layerPrepResult->viewport(),
inRenderData.layerPrepResult->presentationDesignDimensions()));
inCamera.getOrthographicScaleFactor(inRenderData.layerPrepResult->viewport()));
} else {
QVector3D theCameraPos(0, 0, 0);
QVector3D theCameraDir(0, 0, -1);
......
......@@ -449,7 +449,7 @@ void setupCameraForShadowMap(const QVector2D &/*inCameraVec*/,
theCamera.lookAt(inLightPos, QVector3D(0, 1.0, 0), QVector3D(0, 0, 0));
}
theCamera.calculateGlobalVariables(theViewport, QVector2D(theViewport.width(), theViewport.height()));
theCamera.calculateGlobalVariables(theViewport);
}
}
......@@ -486,7 +486,7 @@ void setupCubeShadowCameras(const QSSGRenderLight *inLight, QSSGRenderCamera inC
inCameras[i].position = inLightPos;
inCameras[i].rotation = rotOfs[i];
inCameras[i].calculateGlobalVariables(theViewport, QVector2D(theViewport.width(), theViewport.height()));
inCameras[i].calculateGlobalVariables(theViewport);
}
/*
......@@ -1852,9 +1852,7 @@ void QSSGLayerRenderData::runnableRenderToViewport(const QSSGRef<QSSGRenderFrame
theTempCamera.position.setZ(-theCameraSetback);
theTempCamera.clipFar = 2.0f * theCameraSetback;
// Render the layer texture to the entire viewport.
theTempCamera.calculateGlobalVariables(theLayerViewport,
QVector2D((float)theLayerViewport.width(),
(float)theLayerViewport.height()));
theTempCamera.calculateGlobalVariables(theLayerViewport);
theTempCamera.calculateViewProjectionMatrix(theViewProjection);
QSSGRenderNode theTempNode;
theFinalMVP = theViewProjection;
......
......@@ -56,14 +56,12 @@ inline constexpr float getMaxValue(float start, float width, float value, QSSGRe
QSSGLayerRenderHelper::QSSGLayerRenderHelper(const QRectF &inPresentationViewport,
const QRectF &inPresentationScissor,
const QVector2D &inPresentationDesignDimensions,
QSSGRenderLayer &inLayer,
bool inOffscreen,
ScaleModes inScaleMode,
QVector2D inScaleFactor)
: m_presentationViewport(inPresentationViewport)
, m_presentationScissor(inPresentationScissor)
, m_presentationDesignDimensions(inPresentationDesignDimensions)
, m_layer(&inLayer)
, m_offscreen(inOffscreen)
, m_scaleMode(inScaleMode)
......@@ -190,7 +188,7 @@ QSSGCameraGlobalCalculationResult QSSGLayerRenderHelper::setupCameraForRender(QS
rect.setWidth((float)(QSSGRendererUtil::nextMultipleOf4((quint32)(rect.width() / m_scaleFactor.x()))));
rect.setHeight((float)(QSSGRendererUtil::nextMultipleOf4((quint32)(rect.height() / m_scaleFactor.y()))));
}
return m_camera->calculateGlobalVariables(rect, m_presentationDesignDimensions);
return m_camera->calculateGlobalVariables(rect);
}
QSSGOption<QVector2D> QSSGLayerRenderHelper::layerMouseCoords(const QVector2D &inMouseCoords,
......@@ -224,7 +222,7 @@ QSSGOption<QSSGRenderRay> QSSGLayerRenderHelper::pickRay(const QVector2D &inMous
// The cameras projection is different if we are onscreen vs. offscreen.
// When offscreen, we need to move the mouse coordinates into a local space
// to the layer.
return m_camera->unproject(*theCoords, m_viewport, m_presentationDesignDimensions);
return m_camera->unproject(*theCoords, m_viewport);
}
return QSSGEmpty();
}
......
......@@ -68,7 +68,6 @@ struct QSSGLayerRenderHelper
private:
QRectF m_presentationViewport;
QRectF m_presentationScissor;
QVector2D m_presentationDesignDimensions;
QSSGRenderLayer *m_layer = nullptr;
QSSGRenderCamera *m_camera = nullptr;
bool m_offscreen = false;
......@@ -84,7 +83,6 @@ public:
QSSGLayerRenderHelper(const QRectF &inPresentationViewport,
const QRectF &inPresentationScissor,
const QVector2D &inPresentationDesignDimensions,
QSSGRenderLayer &inLayer,
bool inOffscreen,
ScaleModes inScaleMode,
......@@ -92,7 +90,6 @@ public:
QRectF presentationViewport() const { return m_presentationViewport; }
QRectF presentationScissor() const { return m_presentationScissor; }
QVector2D presentationDesignDimensions() const { return m_presentationDesignDimensions; }
QSSGRenderLayer *layer() const { return m_layer; }
QSSGRenderCamera *camera() const { return m_camera; }
bool isOffscreen() const { return m_offscreen; }
......
......@@ -1054,7 +1054,6 @@ void QSSGLayerRenderPreparationData::prepareForRender(const QSize &inViewportDim
thePrepResult = QSSGLayerRenderPreparationResult(
QSSGLayerRenderHelper(theViewport,
theScissor,
QVector2D(inViewportDimensions.width(), inViewportDimensions.height()),
layer,
shouldRenderToTexture,
renderer->demonContext()->scaleMode(),
......
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick3D 1.0
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
color: "black"
Node {
id: sceneRoot
Light {
}
Model {
source: "#Cone"
materials: DefaultMaterial {
}
}
Model {
source: "#Sphere"
z: 100
x: -100
materials: DefaultMaterial {
}
}
Model {
source: "#Cube"
z: -100
x: 100
materials: DefaultMaterial {
}
}
}
View3D {
anchors.top: parent.top
anchors.left: parent.left
width: parent.width * 0.5
height: parent.height * 0.5
scene: sceneRoot
Camera {
id: perspectiveCamera
z: -600
projectionMode: Camera.Perspective
}
}
View3D {
anchors.top: parent.top
anchors.right: parent.right
width: parent.width * 0.5
height: parent.height * 0.5
scene: sceneRoot
Camera {
id: orthgraphicCamera
z: -600
projectionMode: Camera.Orthographic
}
}
View3D {
id: frustumView
anchors.bottom: parent.bottom
anchors.left: parent.left
width: parent.width * 0.5
height: parent.height * 0.5
scene: sceneRoot
Camera {
id: frustumCamera
z: -600
projectionMode: Camera.Frustum
frustumTop: frustumView.height * 0.05
frustumBottom: frustumView.height * -0.05
frustumRight: frustumView.width * 0.05
frustumLeft: frustumView.width * -0.05
}
}
View3D {
anchors.bottom: parent.bottom
anchors.right: parent.right
width: parent.width * 0.5
height: parent.height * 0.5
scene: sceneRoot
Camera {
id: customCamera
z: -600
projectionMode: Camera.Custom
customProjection: Qt.matrix4x4(1.299, 0, 0, 0,
0, 1.732, 0, 0,
0, 0, -1, -20,
0, 0, -1, 0);
}
}
}
QT += quick
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
#include <QGuiApplication>
#include <QQmlApplicationEngine>