aboutsummaryrefslogtreecommitdiff
path: root/Toast.qml
diff options
context:
space:
mode:
Diffstat (limited to 'Toast.qml')
-rw-r--r--Toast.qml15
1 files changed, 11 insertions, 4 deletions
diff --git a/Toast.qml b/Toast.qml
index 044f509..5a4e0db 100644
--- a/Toast.qml
+++ b/Toast.qml
@@ -1,15 +1,18 @@
import QtQuick 2.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.3
/**
* adapted from StackOverflow:
* http://stackoverflow.com/questions/26879266/make-toast-in-android-by-qml
* GitHub Gist: https://gist.github.com/jonmcclung/bae669101d17b103e94790341301c129
+ * Adapted to work with dark/light theming
*/
/**
* @brief An Android-like timed message text in a box that self-destroys when finished if desired
*/
-Rectangle {
+Control {
/**
* Public
@@ -29,6 +32,7 @@ Rectangle {
else {
time = defaultTime;
}
+ console.log("Showing a new toast with display time: " + time);
animation.start();
}
@@ -53,14 +57,17 @@ Rectangle {
}
height: message.height + margin
- radius: margin
+
+ background: Rectangle {
+ color: (Material.theme == Material.Dark) ? "#212121" : "#dcdedc"
+ radius: margin
+ }
opacity: 0
- color: "#222222"
Text {
id: message
- color: "white"
+ color: (Material.theme == Material.Dark) ? "#f1f1f1" : "#010101"
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
anchors {