Read from tableview



  • How i can read data, from tableview
    my code
    @model->setHeaderData(0, Qt::Horizontal, QObject::tr("Subject"));
    model->setHeaderData(1, Qt::Horizontal, QObject::tr("Sender"));
    model->setHeaderData(2, Qt::Horizontal, QObject::tr("Date"));
    model->insertRow(0);
    model->insertRow(0);
    model->insertRow(0);
    ui->tableView->setModel(model);@
    from 1 column 1 row and 3 column 3 row



  • You read data from the model (QAbstractItemModel::data()), not the view. I don't see what that has to do with the code snippet you posted though.



  • http://screenshooter.net/8431151/onjkjsj <- screenshoot
    @edited all
    now i reading by this
    QString qs = model ->data(model->index(0, 0),Qt::DisplayRole).toString();
    ui->label->setText(qs);
    and adding to last row by this
    @model->insertRow(model ->rowCount());
    model->setData(model->index(model ->rowCount()-1, 0),ui->comboBox->currentText());@
    ty for trying to help me


Log in to reply
 

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