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

List:       kde-commits
Subject:    [kirigami] /: make sure the overlaysheet is direct child of a page
From:       Marco Martin <notmart () gmail ! com>
Date:       2016-05-14 19:26:30
Message-ID: E1b1fCo-0001gS-In () scm ! kde ! org
[Download RAW message or body]

Git commit adad023642017dc674350f468969e998c18e7e97 by Marco Martin.
Committed on 14/05/2016 at 19:24.
Pushed by mart into branch 'master'.

make sure the overlaysheet is direct child of a page

overlaysheet needs to be direct child of a page, as
needs to be on top of all the other contents and must
not have the margins of the page

do it in the Page rathe than from the OverlaySheet as
it was done, in order to keep possible for
OverlayDrawer to be used outside of Page

M  +19   -0    examples/gallery/contents/ui/gallery/NonScrollableGallery.qml
M  +2    -0    src/qml/OverlaySheet.qml
M  +13   -0    src/qml/Page.qml

http://commits.kde.org/kirigami/adad023642017dc674350f468969e998c18e7e97

diff --git a/examples/gallery/contents/ui/gallery/NonScrollableGallery.qml \
b/examples/gallery/contents/ui/gallery/NonScrollableGallery.qml index \
                fe15a4e..253e914 100644
--- a/examples/gallery/contents/ui/gallery/NonScrollableGallery.qml
+++ b/examples/gallery/contents/ui/gallery/NonScrollableGallery.qml
@@ -27,6 +27,16 @@ Page {
     Layout.fillWidth: true
     title: "Simple Page"
 
+    actions {
+        main: Action {
+            iconName: sheet.opened ? "dialog-cancel" : "document-edit"
+            onTriggered: {
+                print("Action button in buttons page clicked");
+                sheet.opened = !sheet.opened
+            }
+        }
+    }
+
     Rectangle {
         anchors.fill: parent
         color: "red"
@@ -35,4 +45,13 @@ Page {
             text: "Rectangle with automatic margins"
         }
     }
+
+    OverlaySheet {
+        id: sheet
+        Label {
+            property int implicitWidth: Units.gridUnit * 45
+            wrapMode: Text.WordWrap
+            text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam \
id risus id augue euismod accumsan. Nunc vestibulum placerat bibendum. Morbi commodo \
auctor varius. Donec molestie euismod ultrices. Sed facilisis augue nec eros auctor, \
vitae mattis quam rhoncus. Nam ut erat diam. Curabitur iaculis accumsan magna, eget \
fermentum massa scelerisque eu. Cras elementum erat non erat euismod accumsan. \
Vestibulum ac mi sed dui finibus pulvinar. Vivamus dictum, leo sed lobortis \
porttitor, nisl magna faucibus orci, sit amet euismod arcu elit eget est. Duis et \
vehicula nibh. In arcu sapien, laoreet sit amet porttitor non, rhoncus vel magna. \
Suspendisse imperdiet consectetur est nec ornare. Pellentesque bibendum sapien at \
erat efficitur vehicula. Morbi sed porta nibh. Vestibulum ut urna ut dolor sagittis \
mattis." +        }
+    }
 }
diff --git a/src/qml/OverlaySheet.qml b/src/qml/OverlaySheet.qml
index 51f87f2..c87b9e8 100644
--- a/src/qml/OverlaySheet.qml
+++ b/src/qml/OverlaySheet.qml
@@ -34,6 +34,8 @@ import "private"
 Item {
     id: root
 
+    z: 999
+
     anchors.fill: parent
     visible: false
 
diff --git a/src/qml/Page.qml b/src/qml/Page.qml
index 1689f1d..353184b 100644
--- a/src/qml/Page.qml
+++ b/src/qml/Page.qml
@@ -282,6 +282,19 @@ Item {
 
     Item {
         id: container
+        onChildrenChanged: {
+            //NOTE: make sure OverlaySheets are directly under the root
+            //so they are over all the contents and don't have margins
+            //TODO: OverlayDrawers as well?
+            //search for an OverlaySheet, unfortunately have to blind test \
properties +            //as there is no way to get the classname from qml objects
+            for (var i = children.length -1; i >= 0; --i) {
+                var child = children[i];
+                if (child.toString().indexOf("OverlaySheet") === 0) {
+                    child.parent = root;
+                }
+            }
+        }
         anchors {
             fill: parent
             leftMargin: leftPadding


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

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