nuliknol
3rd May 2014, 10:58
Hi,
I have created a component in a file "Tabc.qml", like this:
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
Rectangle {
width: parent.width
property int company_id: 0
}
Then in javascript I load the component like this:
onRegisterCompany: {
var component=Qt.createComponent("Tabc.qml");
component.company_id=company_id;
companies_tab.addTab(company_name,component);
console.log("company_id is ",company_id);
}
but when javascript code is executed, I get this error:
file:///home/niko/qtdev/build-forms-Desktop_Qt_5_2_1_GCC_64bit-Debug/qml/forms/main.qml:51: Error: Cannot assign to non-existent property "company_id"
why do i get the non-existent property error if I defined the property in Tabc.qml file ???
Would appreciate very much your comments.
Regards
I have created a component in a file "Tabc.qml", like this:
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
Rectangle {
width: parent.width
property int company_id: 0
}
Then in javascript I load the component like this:
onRegisterCompany: {
var component=Qt.createComponent("Tabc.qml");
component.company_id=company_id;
companies_tab.addTab(company_name,component);
console.log("company_id is ",company_id);
}
but when javascript code is executed, I get this error:
file:///home/niko/qtdev/build-forms-Desktop_Qt_5_2_1_GCC_64bit-Debug/qml/forms/main.qml:51: Error: Cannot assign to non-existent property "company_id"
why do i get the non-existent property error if I defined the property in Tabc.qml file ???
Would appreciate very much your comments.
Regards