diff options
author | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2020-07-30 07:48:21 +0200 |
---|---|---|
committer | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2020-07-30 07:49:53 +0200 |
commit | 9bacfb6c56bb1f863eb7ab7ab8d77840f3507b72 (patch) | |
tree | 4603fb530621bdb9fe4603e3ae02f7bfc4519976 /Toast.qml | |
parent | f0dc186cf00fb6952531d124e714cbb2f39b737e (diff) | |
download | RWA.Support.DesktopApp-9bacfb6c56bb1f863eb7ab7ab8d77840f3507b72.tar.gz RWA.Support.DesktopApp-9bacfb6c56bb1f863eb7ab7ab8d77840f3507b72.tar.bz2 RWA.Support.DesktopApp-9bacfb6c56bb1f863eb7ab7ab8d77840f3507b72.zip |
Add dark mode
Diffstat (limited to 'Toast.qml')
-rw-r--r-- | Toast.qml | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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 { |