Added "hideBack" property to hide back button
authorMohammed Sameer <msameer@foolab.org>
Mon, 15 Jul 2013 20:24:57 +0000 (23:24 +0300)
committerMohammed Sameer <msameer@foolab.org>
Mon, 15 Jul 2013 20:28:48 +0000 (23:28 +0300)
qml/CameraToolBar.js
qml/CameraToolBar.qml

index 4371bbf..8ecb835 100644 (file)
@@ -56,16 +56,24 @@ function show(items) {
        width += items[x].width;
     }
 
-    var spacing = (tools.width - width - tools.menuWidth) / len;
+    var totalWidth = tools.width - width;
+    if (tools.hideBack) {
+       len -= 1;
+    } else {
+       totalWidth -= tools.menuWidth;
+    }
 
-    for (var x = 0; x < len; x++) {
+    var spacing = totalWidth / len;
+
+    for (var x = 0; x < items.length; x++) {
        var child = items[x];
 
        if (x != 0) {
            var prev = items[x - 1];
            child.x = prev.x + prev.width + spacing;
-       }
-       else {
+       } else if (tools.hideBack) {
+           child.x = 0;
+       } else {
            child.x = spacing + 80;
        }
 
index 7bd030e..b5f61b9 100644 (file)
@@ -31,6 +31,7 @@ Rectangle {
     property int targetWidth: parent.width - (2 * anchors.leftMargin)
     property alias menuWidth: menu.width
     property bool manualBack: false
+    property bool hideBack: false
     signal clicked
 
     height: menu.height
@@ -45,6 +46,7 @@ Rectangle {
 
     ToolIcon {
         property bool __isMenu: true
+        visible: !parent.hideBack
         id: menu
         anchors.verticalCenter: parent.verticalCenter
         iconSource: "image://theme/icon-m-toolbar-back-white"