[Interest] Setting current row in QSqlTableModel

M. Bashir Al-Noimi mbnoimi at gmail.com
Thu Apr 18 18:43:02 CEST 2013


Hi,

Could you please guide me how can I set the current row in QSqlTableModel?

PS
I’ve QTableView and QComboBox both of them attached to same QSqlTableModel
I want to set the current row in QTableView dependeing on selected index in
QComboBox. I can get the selected index in QComboBox through
currentIndexChanged(int index) slot but I don’t know to set the current in
QSqlTableModel.



   1. void MainWindow::on_comboBox_find_currentIndexChanged(int index)
   2. {
   3.     if (p_db.isOpen()) {
   4.         //! \bug doesn't select the row although the index is correct!
   5.         if (p_tableModel->selectRow(index)) {
   6.             qDebug() << index;
   7.         }
   8.     }
   9. }



-- 
Best Regards
Muhammad Bashir Al-Noimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130418/79315d93/attachment.html>


More information about the Interest mailing list