[Interest] deleting row from QSqlTableModel - not working

Sujan Dasmahapatra sujan.dasmahapatra at gmail.com
Sat May 5 14:29:32 CEST 2012


I am trying to delete a row from QSqlTableModel which is show in the
QTableView but it's not working please help.

    MainWindow *mainwindow;

  QSqlTableModel *model;

  QTableView *view;


        model = new QSqlTableModel(this,mainwindow->db);

    model->setTable("Tbl_Drawing");

    model->select();

    view = new QTableView;

    QHeaderView *m_vert_header= view->verticalHeader();

    connect(m_vert_header, SIGNAL(sectionClicked ( int ) ),

    this, SLOT(deleteRow ( int ) ));

    view->setModel(model);

    view->show();



The above way I am able to show the entries........now deleting a row like this



    view->model()->removeRow(index, view->currentIndex());



But  it's not removing the entry from the table..The item is still
shown.....Please help me whats going wrong in this



Thanks Sujan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120505/7841656e/attachment.html>


More information about the Interest mailing list