mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-22 10:42:29 +01:00
Add simple hello world widget
This commit is contained in:
parent
9b824a5192
commit
c30ccd64f0
1
Content/widget_hello_world/Readme.md
Normal file
1
Content/widget_hello_world/Readme.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Widget that shows the latest xkcd
|
48
Content/widget_hello_world/main.qml
Normal file
48
Content/widget_hello_world/main.qml
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
Content/widget_hello_world/preview.png
Normal file
BIN
Content/widget_hello_world/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
10
Content/widget_hello_world/project.json
Normal file
10
Content/widget_hello_world/project.json
Normal 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"
|
||||||
|
}
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user