PDA

View Full Version : setting QML Drawer properties in another QML file



arcade
14th September 2017, 15:38
Qjay a day ago
I have a main.qml file that has a drawer in it .


// some imports
//Some code
Drawer {
id: drawer
width: Math.min(window.width, window.height) / 3 * 2
height: window.height
onOpened:
webview.visible = false

onClosed:
webview.visible = true

ColumnLayout {
anchors.fill: parent
Rectangle {
id: search_field
width: drawer.width
height: 50
// some code

2nd qml file


import QtQuick 2.6
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import en.wtl.org 1.0
import en.wtl.model 1.0
import QtWebView 1.1

Pane{

id: view
property string local_url : ""
property string pid : ""


ListView {
width: 200; height: 250

model: myModel
delegate: Component{
RowLayout{
Button {
id: name
text: title
visible: true
Layout.fillWidth: true
onClicked: {

local_url = path+"/WTL_appdata/"+id+"/"+id+".html"
console.log(local_url);
pid = id;
//webview.url = local_url
webview.visible = true
}

}
}

}
}




WebView{
id: webview
url: "file:///"+path+"/WTL_appdata/"+pid+"/"+pid+".html"
visible: false
anchors.fill: parent

}

}


what i want to do is set the "webview.visible = true only when drawer onclosed property is true and set it to invisible when drawer onopened property is true .

so question is how can i access this


onOpened:
webview.visible = false

onClosed:
webview.visible = true

in my 2nd qml file .