[SOLVED] QStandarItem clean data



  • Hello!

    I have a QStabdardItemModel and I need to clear the data of one cell but dont remove the row

    I am trying this but its not working

    @
    modeloLancamentosAmortizacao->data(modeloLancamentosAmortizacao->index(0,2)).clear();
    @

    this way does not work either

    @
    QStandardItem *item = modeloLancamentosAmortizacao->item(0,2);
    item->data().clear();
    @

    How can I do that?

    Thanks



  • Try the following or some variant of the following ?
    @
    QVariant dat(tr(""));
    item->setData(index,dat);

    or

    QVariant var = item.data();
    var.clear()
    var.setValue("")
    item.setData(var)@



  • Yes, it worked



  • May be you can move this request to <Solved> state by editing the subject line of this question.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.