PDA

View Full Version : QML-Get tableview cell content



neda
4th April 2016, 09:53
Hi.
I have a TableView with 3 columns (column 1=checkbox, column 2=X and column 3 =Y ).
I want to get cell content of selected row (checked checkbox in column 3 of row).
Immediately after checking checkbox draw a circle in specefic position (x,y).

Model of tableview is QStandardItemModel.

Code:

Canvas {
id: canvas
anchors.fill: parent
onPaint: {
var ctx = canvas.getContext("2d");
ctx.globalCompositeOperation = "source-over";
ctx.lineWidth = 1;
for(var i=1;i<=tablemodel.rowCount;i++){
console.log(tablemodel.model.get(i).XData);
console.log(tablemodel.model.get(i).YData);

I have this error:
TypeError: Property 'get' of object QStandardItemModel is not a function

Please guide me

anda_skoa
4th April 2016, 10:06
Have you derived from QStandardItemModel and added a get() function and made it Q_INVOKABLE?

Cheers,
_

neda
4th April 2016, 10:15
Have you derived from QStandardItemModel and added a get() function and made it Q_INVOKABLE?

_

Thank you,
Excuse me for this simple question.