QtAndroidTools/QtAndroidToolsDemo/tools/AndroidNotification.qml

93 lines
2.8 KiB
QML
Raw Normal View History

2019-03-29 10:21:42 +01:00
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.3
import QtAndroidTools 1.0
2019-04-03 14:21:46 +02:00
ScrollablePage {
2019-03-29 10:21:42 +01:00
id: page
2019-04-03 14:21:46 +02:00
padding: 20
2019-03-29 10:21:42 +01:00
Column {
2019-04-03 14:21:46 +02:00
anchors.fill: parent
2019-03-29 10:21:42 +01:00
spacing: 20
2019-04-03 14:21:46 +02:00
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: "Notification 1"
font.bold: true
}
2019-03-29 10:21:42 +01:00
QtAndroidNotification {
id: notification1
2019-04-03 14:21:46 +02:00
title: "Notification 1 title"
text: "This is the notification 1 content"
expandableText: "This is a very very very very very very very very very very long expandable content"
2019-03-29 10:21:42 +01:00
channelName: "Notification channel 1"
2019-03-29 16:31:33 +01:00
smallIconName: "qtatoolsdemo_notification_icon1"
largeIconSource: ":/images/logo_falsinsoft.jpg"
2019-03-29 10:21:42 +01:00
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Show notification"
2019-04-03 14:21:46 +02:00
onClicked: notification1.show()
2019-03-29 16:31:33 +01:00
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Cancel notification"
onClicked: notification1.cancel()
}
2019-04-03 14:21:46 +02:00
Label {
anchors.horizontalCenter: parent.horizontalCenter
2019-04-04 13:51:46 +02:00
text: "Notification 2"
2019-04-03 14:21:46 +02:00
font.bold: true
}
2019-03-29 16:31:33 +01:00
QtAndroidNotification {
id: notification2
2019-04-03 14:21:46 +02:00
title: "Notification 2 title"
text: "This is the notification 2 content"
2019-03-29 16:31:33 +01:00
channelName: "Notification channel 2"
smallIconName: "qtatoolsdemo_notification_icon2"
2019-04-03 14:21:46 +02:00
largeIconSource: ":/images/logo_falsinsoft.jpg"
2019-03-29 16:31:33 +01:00
}
CheckBox {
id: showProgressBar
text: "Show progress bar"
checked: false
onCheckedChanged: {
if(checked)
{
notification2.progressBar.max = sliderBar.to;
notification2.progressBar.current = sliderBar.value;
}
else
{
notification2.progressBar.max = 0;
notification2.progressBar.current = 0;
}
}
}
Slider {
id: sliderBar
enabled: showProgressBar.checked
width: parent.width
from: 0
to: 100
value: 0
onValueChanged: notification2.progressBar.current = sliderBar.value
}
2019-03-29 16:31:33 +01:00
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Show notification"
2019-04-03 14:21:46 +02:00
onClicked: notification2.show()
2019-03-29 16:31:33 +01:00
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Cancel notification"
onClicked: notification2.cancel()
2019-03-29 10:21:42 +01:00
}
}
}