[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kirigami] /: take global footer into account for handle position
From:       Marco Martin <null () kde ! org>
Date:       2018-02-08 10:40:45
Message-ID: E1ejjdF-0001Vm-O8 () code ! kde ! org
[Download RAW message or body]

Git commit 89585fbd2b060094e29668be7080a8c6dbf8ef7a by Marco Martin.
Committed on 08/02/2018 at 10:38.
Pushed by mart into branch 'master'.

take global footer into account for handle position

A  +79   -0    examples/simpleexamples/footer.qml     [License: LGPL (v2+)]
M  +11   -6    src/controls/templates/OverlayDrawer.qml

https://commits.kde.org/kirigami/89585fbd2b060094e29668be7080a8c6dbf8ef7a

diff --git a/examples/simpleexamples/footer.qml b/examples/simpleexamples/footer.qml
new file mode 100644
index 0000000..c8239e5
--- /dev/null
+++ b/examples/simpleexamples/footer.qml
@@ -0,0 +1,79 @@
+/*
+ *   Copyright 2016 Marco Martin <mart@kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as
+ *   published by the Free Software Foundation; either version 2 or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+import QtQuick 2.1
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 2.0 as Controls
+import org.kde.kirigami 2.2 as Kirigami
+
+Kirigami.ApplicationWindow {
+    id: root
+
+    footer: Controls.ToolBar {
+        //height: Kirigami.Units.gridUnit * 3
+        RowLayout {
+            Controls.ToolButton {
+                text: "text"
+            }
+        }
+    }
+    globalDrawer: Kirigami.GlobalDrawer {
+        title: "Hello App"
+        titleIcon: "applications-graphics"
+
+        actions: [
+            Kirigami.Action {
+                text: "View"
+                iconName: "view-list-icons"
+                Kirigami.Action {
+                    text: "action 1"
+                }
+                Kirigami.Action {
+                    text: "action 2"
+                }
+                Kirigami.Action {
+                    text: "action 3"
+                }
+            },
+            Kirigami.Action {
+                text: "action 3"
+            },
+            Kirigami.Action {
+                text: "action 4"
+            }
+        ]
+    }
+    contextDrawer: Kirigami.ContextDrawer {
+        id: contextDrawer
+    }
+
+    pageStack.initialPage: mainPageComponent
+
+    Component {
+        id: mainPageComponent
+        Kirigami.ScrollablePage {
+            title: "Hello"
+            Rectangle {
+                anchors.fill: parent
+            }
+        }
+    }
+
+
+}
diff --git a/src/controls/templates/OverlayDrawer.qml \
b/src/controls/templates/OverlayDrawer.qml index 905d2a5..4ae6e95 100644
--- a/src/controls/templates/OverlayDrawer.qml
+++ b/src/controls/templates/OverlayDrawer.qml
@@ -130,10 +130,15 @@ T2.Drawer {
                     return;
                 }
 
+                var margin = 0;
+                if (applicationWindow().footer) {
+                    margin = applicationWindow().footer.height;
+                }
+
                 if (!applicationWindow() || !applicationWindow().pageStack ||
                     !applicationWindow().pageStack.contentItem ||
                     !applicationWindow().pageStack.contentItem.itemAt) {
-                    return 0;
+                    return margin;
                 }
 
                 var item;
@@ -148,12 +153,12 @@ T2.Drawer {
                     item = \
applicationWindow().pageStack.get(applicationWindow().pageStack.depth-1);  }
 
-                var footer = item && item.page ? item.page.footer : (item ? \
                item.footer : undefined);
-                if (footer) {
-                    return footer.height
-                } else {
-                    return 0;
+                var pageFooter = item && item.page ? item.page.footer : (item ? \
item.footer : undefined); +                if (pageFooter) {
+                    margin += pageFooter.height;
                 }
+
+                return margin;
             }
             Behavior on bottomMargin {
                 NumberAnimation {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic