[Interest] deleting row from QSqlTableModel - not working
Alex Malyushytskyy
alexmalvtk at gmail.com
Tue May 8 02:17:19 CEST 2012
try the following ( assuming index is equal to row ):
view->model()->removeRow(index);
Alex
On Sat, May 5, 2012 at 5:29 AM, Sujan Dasmahapatra
<sujan.dasmahapatra at gmail.com> wrote:
> 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
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
More information about the Interest
mailing list