stereoMatching
29th June 2013, 23:39
Using loader to load the component but always get error(warning?or just a state report?) message
main.qml
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
Rectangle {
width: 100
height: 62
ImageView{
id:imView
anchors.fill: parent
}
Image{
anchors.fill: parent
//this is where the problem come from
source: imView.getCurrentFile()
}
}
ImageView
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
Rectangle {
width: 100
height: 62
function appendFiles(files){
for(var i = 0; i != files.length; ++i){
filesModel.append({"source": files[i]})
}
}
//this is where the problem come from
function getCurrentFile(){
if(loader.status == Loader.Ready){
return filesModel.get(loader.item.currentRow).source
}
return "-1"
}
ListModel{
id: filesModel
}
Loader{
id: loader
sourceComponent: tableViewHeavyComponent
}
Component{
id: tableViewHeavyComponent
Rectangle{
}
}
}
Could I safely omit this error message, if not
how should I deal with it?
main.qml
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
Rectangle {
width: 100
height: 62
ImageView{
id:imView
anchors.fill: parent
}
Image{
anchors.fill: parent
//this is where the problem come from
source: imView.getCurrentFile()
}
}
ImageView
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
Rectangle {
width: 100
height: 62
function appendFiles(files){
for(var i = 0; i != files.length; ++i){
filesModel.append({"source": files[i]})
}
}
//this is where the problem come from
function getCurrentFile(){
if(loader.status == Loader.Ready){
return filesModel.get(loader.item.currentRow).source
}
return "-1"
}
ListModel{
id: filesModel
}
Loader{
id: loader
sourceComponent: tableViewHeavyComponent
}
Component{
id: tableViewHeavyComponent
Rectangle{
}
}
}
Could I safely omit this error message, if not
how should I deal with it?