Stardelegate example - how to read data from my own widget item
-
wrote on 22 Nov 2012, 11:38 last edited by
Hello
I am creating code based on this stardelegate example: http://doc.qt.digia.com/qt/itemviews-stardelegate.html . I designed my own similar widget but only with checked-unchecked icon. I need to read all table parameters after button click or sth like that. If I want to read widget item integer value I am using for ex:
@val[i] = ui->tableIn->item(0 + i*3, 2)->text().toInt();@but unfortunatelly I have no idea how to read a number of stars from this example outside delegate. I was trying item(row, col)->data(0) etc but I don't know how to read this qVariant as integer or bool in my example.
When I want to write to my widget element I am using this construct:
@ui->tableIn->item(0 + i*3, 2)->setData(0, qVariantFromValue(IconPainter(booleanValue)));@
there is in stardelegate example:
@item3->setData(0, qVariantFromValue(StarRating(staticData[row].rating)));@Best reagrds,
nibbit -
wrote on 26 Nov 2012, 14:02 last edited by
Hello
I found solution for my problem. That is for example:
@val = IconPainter(qVariantValue<IconPainter>(ui->table->item(0 + i*3, 0)->data(0))).getState();@I hope that's optimal solution :)
1/2