i want to send the textfield text from main.qml to search.qml file
main.qml snippet
TextField{
id: search_text
placeholderText: " Search "
width: drawer.width
Image {
id: search_button
anchors.right: search_text.right
anchors.verticalCenter: search_text.verticalCenter
source: "qrc:/images/search.png"
MouseArea{
anchors.fill: search_button
onClicked: {
loader.source = "qrc:/pages/search.qml"
stackView.push(loader.item)
listView.currentIndex = -1
}
}
}
}
TextField{
id: search_text
placeholderText: " Search "
width: drawer.width
Image {
id: search_button
anchors.right: search_text.right
anchors.verticalCenter: search_text.verticalCenter
source: "qrc:/images/search.png"
MouseArea{
anchors.fill: search_button
onClicked: {
loader.source = "qrc:/pages/search.qml"
stackView.push(loader.item)
listView.currentIndex = -1
}
}
}
}
To copy to clipboard, switch view to plain text mode
search.qml
import QtQuick 2.6
import QtQuick.Controls 2.0
import QtWebView 1.1
Pane {
id: pane
// recieve texinput here so that i can construct url
WebView{
id:webview
anchors.fill: parent
Component.onCompleted: url = "http://en.wikitolearn.org/"
}
}
import QtQuick 2.6
import QtQuick.Controls 2.0
import QtWebView 1.1
Pane {
id: pane
// recieve texinput here so that i can construct url
WebView{
id:webview
anchors.fill: parent
Component.onCompleted: url = "http://en.wikitolearn.org/"
}
}
To copy to clipboard, switch view to plain text mode
what i have tried ( i tried create a property in Search.qml and access this property through Loader.
For eg.
TextField{
id: search_text
placeholderText: " Search WikiToLearn"
width: drawer.width
onAccepted: {
loader.item.search = search_text.text
loader.source = "qrc:/pages/search.qml"
stackView.push(loader.item)
listView.currentIndex = -1
}
TextField{
id: search_text
placeholderText: " Search WikiToLearn"
width: drawer.width
onAccepted: {
loader.item.search = search_text.text
loader.source = "qrc:/pages/search.qml"
stackView.push(loader.item)
listView.currentIndex = -1
}
To copy to clipboard, switch view to plain text mode
but i got error :
qrc:/main.qml:104: TypeError: Type error
qrc:/main.qml:104: TypeError: Type error
Bookmarks