mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-22 01:05:17 +00:00
QtQuick background test
This commit is contained in:
parent
8552e08a12
commit
4453492204
|
@ -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
|
||||
|
|
BIN
qtquick/assets/img/particle.png
Normal file
BIN
qtquick/assets/img/particle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 690 B |
7
qtquick/qml.qrc
Normal file
7
qtquick/qml.qrc
Normal 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>
|
36
qtquick/qml/components/Background.qml
Normal file
36
qtquick/qml/components/Background.qml
Normal 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
14
qtquick/qml/main.qml
Normal 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
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue