1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-12-22 14:05:18 +00:00

QtQuick background test

This commit is contained in:
Chris Josten 2021-02-16 18:01:17 +01:00
parent 8552e08a12
commit 4453492204
6 changed files with 74 additions and 3 deletions

View file

@ -1,8 +1,9 @@
find_package(Qt5 COMPONENTS Gui Qml Quick)
set(sailfin_SOURCES
src/main.cpp)
src/main.cpp)
add_executable(sailfin ${sailfin_SOURCES})
qt5_add_resources(sailfin_RESOURCES qml.qrc)
add_executable(sailfin ${sailfin_SOURCES} ${sailfin_RESOURCES})
target_link_libraries(sailfin PUBLIC Qt5::Gui Qt5::Qml Qt5::Quick jellyfin-qt)
install(TARGETS sailfin

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

7
qtquick/qml.qrc Normal file
View file

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/">
<file>qml/main.qml</file>
<file>qml/components/Background.qml</file>
<file>assets/img/particle.png</file>
</qresource>
</RCC>

View file

@ -0,0 +1,36 @@
import QtQuick 2.12
import QtQuick.Particles 2.12
Rectangle {
color: "black"
ParticleSystem {
id: particleSystem
}
Emitter {
id: emitter
anchors.fill: parent
system: particleSystem
emitRate: width * height / (lifeSpan * 100)
lifeSpan: 10000
lifeSpanVariation: 500
size: 16
endSize: 64
}
Wander {
anchors.fill: parent
system: particleSystem
pace: 100
affectedParameter: Wander.Velocity
xVariance: 300
yVariance: 300
}
ImageParticle {
source: "/assets/img/particle.png"
system: particleSystem
}
}

14
qtquick/qml/main.qml Normal file
View file

@ -0,0 +1,14 @@
import QtQuick 2.12
import QtQuick.Window 2.12
import "components"
Window {
width: 600
height: 600
visible: true
Background {
anchors.fill: parent
}
}

View file

@ -1,9 +1,22 @@
#include <QDebug>
#include <QQmlApplicationEngine>
#include <QGuiApplication>
#include <QString>
#include <JellyfinQt/jellyfin.h>
int main(int argc, char** argv) {
QGuiApplication app(argc, argv);
Jellyfin::registerTypes();
app.setApplicationDisplayName(QStringLiteral("Sailfin QtQuick"));
qDebug() << "Creating engine";
QQmlApplicationEngine engine;
qDebug() << "Registering types";
Jellyfin::registerTypes();
qDebug() << "Loading file";
engine.load(QStringLiteral("qrc:/qml/main.qml"));
qDebug() << "Entering event loop";
return app.exec();
}