From 3ec5d94c301ebd27eec80dbc59811540d7d62969 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 28 Oct 2014 13:14:52 +0100 Subject: [PATCH] Menu: Use property bindings instead of one-off assignments --- touch/Main.qml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/touch/Main.qml b/touch/Main.qml index 29d9621..bd48616 100644 --- a/touch/Main.qml +++ b/touch/Main.qml @@ -102,16 +102,10 @@ Item { var page = children[children.length+offset-1]; - // TODO: Maybe make these property bindings instead - pgst.hasBackButton = (!page.isDialog && page.canClose); - pgst.hasMenuButton = page.hasMenuButton; - if (pgst.hasMenuButton) { - pgst.menuButtonLabel = page.menuButtonLabel; - pgst.menuButtonIcon = page.menuButtonIcon; - } else { - pgst.menuButtonLabel = 'Menu'; - pgst.menuButtonIcon = Icons.vellipsis; - } + pgst.hasBackButton = Qt.binding(function () { return (!page.isDialog && page.canClose); }); + pgst.hasMenuButton = Qt.binding(function () { return page.hasMenuButton; }); + pgst.menuButtonLabel = Qt.binding(function () { return pgst.hasMenuButton ? page.menuButtonLabel : 'Menu'; }); + pgst.menuButtonIcon = Qt.binding(function () { return pgst.hasMenuButton ? page.menuButtonIcon : Icons.vellipsis; }); } function showConfirmation(title, affirmative, negative, description, icon, callback) {