From c7956f98ab9cdff4767f11005c7c816a540ba3ab Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 18 Aug 2018 20:10:57 +0200 Subject: Overlay positioning via the base View This fixes the position when running the search view main.qml --- framework/qml/View.qml | 14 ++++++++++---- views/search/qml/View.qml | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/framework/qml/View.qml b/framework/qml/View.qml index 859b7155..64524999 100644 --- a/framework/qml/View.qml +++ b/framework/qml/View.qml @@ -19,19 +19,25 @@ import QtQuick 2.7 -import QtQuick.Controls 2.0 as Controls2 +import QtQuick.Controls 2 import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube FocusScope { id: root + //Use overlayArea to position an overlay window, parented to ApplicationWindow.window, over just the view-section without the sidebar. + property int sidebarWidth: ApplicationWindow.window.sidebarWidth ? ApplicationWindow.window.sidebarWidth : 0 + property int windowWidth: ApplicationWindow.window.width ? ApplicationWindow.window.width : width + property int windowHeight: ApplicationWindow.window.height ? ApplicationWindow.window.height : height + property rect overlayArea: Qt.rect(sidebarWidth, 0, windowWidth - sidebarWidth, windowHeight) + //Search property rect searchArea property string filter: "" property var searchObject: null function triggerSearch() { - if (!searchObject && Controls2.StackView.visible) { + if (!searchObject && StackView.visible) { searchObject = searchComponent.createObject(root) } } @@ -60,11 +66,11 @@ FocusScope { //This signal will be emitted once all initial properties have been set and the view is ready to load signal setup() - Controls2.StackView.onActivated: { + StackView.onActivated: { root.setup() } - Controls2.StackView.onDeactivated: { + StackView.onDeactivated: { clearSearch() } diff --git a/views/search/qml/View.qml b/views/search/qml/View.qml index d7b9a230..47cb18ef 100644 --- a/views/search/qml/View.qml +++ b/views/search/qml/View.qml @@ -34,10 +34,10 @@ Kube.View { id: overlay parent: ApplicationWindow.overlay - height: app.height - width: app.width - app.sidebarWidth - x: app.sidebarWidth - y: 0 + height: overlayArea.height + width: overlayArea.width + x: overlayArea.x + y: overlayArea.y visible: root.visible && root.searchTerm == "" -- cgit v1.2.3