Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Read from tableview
Qt 6.11 is out! See what's new in the release blog

Read from tableview

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jackraymund
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jackraymund
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved