Important: Please read the Qt Code of Conduct -

select row from qtableview

  • hello, i have a problem, here is the code that works fine :
    QSqlQueryModel *model = new QSqlQueryModel(table);
    model->setQuery(QSqlQuery(request, connectionWidget->currentDatabase()));

    after that i'm trying to read data from second column:

    QModelIndexList indexlist = table->selectionModel()->selectedIndexes();
    qDebug()<< "pls work" << indexlist.count() ;

    and indexlist.count() is zero, but my table have some data, can someone suggest anything? sry for my eng and thanks in advance!i'm trying to solve this whole day..

  • table->model()->data(table->model()->index(0,i)).toString(); this works!

Log in to reply