[SOLVED] Reference error: id is not defined
-
wrote on 2 Jan 2015, 18:49 last edited by
After clicking row in table view I get this error:
"ReferenceError: customID is not defined", despite of fact that I have element with this ID. What's wrong?Here is code (only that, what in my opinion is important in this case)
@
import QtQuick.Layouts 1.0
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2Rectangle
{
ListModel
{
id: usersModel
}TabView { Tab { title: "1" RowLayout { ColumnLayout { TableView { onClicked: customID.color = "#FFFFFF" TableViewColumn { } } } Rectangle { TabView { Tab { title: "A" Rectangle { id: customID color: "#00000000" } } } } } } }
}
@ -
wrote on 2 Jan 2015, 21:20 last edited by
Hi
customerId is within a Tab (which inherits from Loader), so it's not possible to use customerId to refere to the element from outside the Tab/Loader using customerId.
You can look "here":http://doc.qt.io/qt-5/qml-qtquick-loader.html#receiving-signals-from-loaded-objects for one way of accessing "customID".
I would probably create a property in the top TabView to propagate the information
-
wrote on 3 Jan 2015, 13:21 last edited by
Thank you very much! Now it works.
1/3