From 4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 19 Aug 2015 11:13:35 +0200 Subject: Extract all settings into `SettingsHandler` object This enables the user to straight forwardly change all application settings via command mode. During the implementation of this change I discovered that the way I was passing around `StateHandler` and `SettingsHandler` instances using properties was unnecessary. If all object instances are created in a common hierarchy they can access each other by their `id` property - i.e. `settings` and `mode` are available to the whole application without property trickery. --- src/widget/Highlighter.qml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/widget/Highlighter.qml') diff --git a/src/widget/Highlighter.qml b/src/widget/Highlighter.qml index b2db7f6..53f308c 100644 --- a/src/widget/Highlighter.qml +++ b/src/widget/Highlighter.qml @@ -1,18 +1,10 @@ import QtQuick 2.0 -import Qt.labs.settings 1.0 Item { - property Settings settings : Settings { - category: "highlighter" - - property string defaultColor : "#909636" - property string focusColor : "#352F6A" - } - - function select() { bar.opacity = 1 } - function deselect() { bar.opacity = 0 } - function focus() { bar.color = settings.focusColor } - function unfocus() { bar.color = settings.defaultColor } + function select() { bar.opacity = 1 } + function deselect() { bar.opacity = 0 } + function focus() { bar.color = settings.highlighter.focusColor } + function unfocus() { bar.color = settings.highlighter.defaultColor } Rectangle { id: bar @@ -20,7 +12,7 @@ Item { anchors.fill: parent opacity: 0 - color: settings.defaultColor + color: settings.highlighter.defaultColor Behavior on opacity { NumberAnimation { -- cgit v1.2.3