Menu: Use property bindings instead of one-off assignments

This commit is contained in:
Thomas Perl 2014-10-28 13:14:52 +01:00
parent 40b389e390
commit 3ec5d94c30

View file

@ -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) {