1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Add simple hello world widget

This commit is contained in:
Elias Steurer 2023-03-25 14:26:17 +01:00
parent 9b824a5192
commit c30ccd64f0
5 changed files with 62 additions and 2 deletions

View File

@ -0,0 +1 @@
Widget that shows the latest xkcd

View File

@ -0,0 +1,48 @@
// SPDX-License-Identifier: BSD-3-Clause
import QtQuick // Base include for basic types like Item and Rectangle
import QtQuick.Layouts // Include for all layout types
import QtQuick.Controls // Include for all controls types like Slider
import QtQuick.Controls.Material // This includes tells qml to use Material style
Item {
id: root
implicitWidth: 250
implicitHeight: 360
ColumnLayout {
anchors.fill: parent
anchors.margins: 20
Rectangle {
width: 100
height: 100
radius: 10
color: "steelBlue"
// Bind the value of the slider
// to the opacity of the rectangle
opacity: sizeSlider.value
// Animate the opacity change to make it smooth
Behavior on opacity {
NumberAnimation {
duration: 100
}
}
}
Text {
text: "Hi! Slider value: " + Math.floor(sizeSlider.value * 100) + "%"
color: "white"
}
// See all available controls like Buttons, TextFields, etc. here:
// https://doc.qt.io/qt-6/qtquick-controls2-qmlmodule.html
Slider {
id: sizeSlider
from: 0
value: 0.8
stepSize: 0.4
to: 1
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -0,0 +1,10 @@
{
"description": "Hello World Widget",
"file": "main.qml",
"preview": "preview.png",
"tags": [
"widget_hello_world"
],
"title": "widget_hello_world",
"type": "qmlWidget"
}

View File

@ -40,9 +40,10 @@ int main(int argc, char* argv[])
QString exampleContentPath = QString(SCREENPLAY_SOURCE_DIR) + "/Content"; QString exampleContentPath = QString(SCREENPLAY_SOURCE_DIR) + "/Content";
QStringList contentFolder = { QStringList contentFolder = {
"/widget_system_stats", // Note: Windows only
"/widget_countDown",
"/widget_weather", "/widget_weather",
"/widget_system_stats", // Note: Windows only
"/widget_hello_world",
"/widget_countDown",
"/widget_analogClock", "/widget_analogClock",
"/widget_digitalClock", "/widget_digitalClock",
"/widget_rss_reddit", "/widget_rss_reddit",