I have the following code. I need to set different "model" field for different TableViews. How can i do this?
I need override "model" field for every TableView. It is possible?
// main.qml
ApplicationWindow {
id: window
TabView {
Tab {
title: "Tab 1"
MyTable {}
}
Tab {
title: "Tab 2"
MyTable {}
}
}
}
.
// MyTable.qml
MyTableView {
TableView {
TableViewColumn {
role: "number"
title: "Number"
}
model: MyModel
}
}
The next code is correct but too long.
// main.qml
ApplicationWindow {
id: window
TabView {
Tab {
title: "Tab 1"
TableView {
TableViewColumn {
role: "number"
title: "Number"
}
model: MyModel_1
}
}
Tab {
title: "Tab 2"
TableView {
TableViewColumn {
role: "number"
title: "Number"
}
model: MyModel_2
}
}
}
}
MyTable
? So inmain.qml
, every time you create an instance ofMyTable {}
, the model can be changed? – TrebledJMyTable {}
. – dzukp