How to delete a entire by selecting particular row from QTableview using push button and table is connected with database
-
wrote on 3 May 2017, 13:44 last edited by
How to delete a entire by selecting particular row from QTableview using push button and table is connected with database
-
How to delete a entire by selecting particular row from QTableview using push button and table is connected with database
wrote on 3 May 2017, 14:01 last edited byYou might consider using QTableWidget which inherits from QTableView. There you can remove rows
-
wrote on 4 May 2017, 06:52 last edited by
i am familiar with tableview and it is very easy to do inserting and updating data from the database so......using tableview we can't delete it?
-
wrote on 4 May 2017, 07:12 last edited by VRonin 5 Apr 2017, 07:12
-
i am familiar with tableview and it is very easy to do inserting and updating data from the database so......using tableview we can't delete it?
wrote on 4 May 2017, 07:24 last edited by@veera said in How to delete a entire by selecting particular row from QTableview using push button and table is connected with database:
i am familiar with tableview and it is very easy to do inserting and updating data from the database so......using tableview we can't delete it?
There are probably good reasons that there is no delete command in table view. My personal guess is the view part of the name.
I suggest that you make yourself a bit more familiar with C++ and the meaning of inheritance especially. In the nutshell it means that the functionality is mostly available in the class inheriting from another.
Most likely you can use QTableWidget instead of QTableView in your apps.
Also as @VRonin already marked you are repeating topics and questions, which is typically not appreciated by all members of the forum.
-
wrote on 4 May 2017, 13:01 last edited by
Hi all,
by passing id of tableview from line edit and execute query ,we can delete the entire row easily but selecting row and delete pushbutton is not happening is there any specific reason explain me plz..... -
Hi all,
by passing id of tableview from line edit and execute query ,we can delete the entire row easily but selecting row and delete pushbutton is not happening is there any specific reason explain me plz.....wrote on 4 May 2017, 13:21 last edited by@veera said in How to delete a entire by selecting particular row from QTableview using push button and table is connected with database:
by passing id of tableview from line edit and execute query ,we can delete the entire row easily
Let's start from here. can you show us this code?
-
wrote on 17 May 2017, 14:30 last edited by veera
calculating the index of particular row of tableview by executing these two queries it was solved....
QModelIndexList ids = ui->tableView->selectionModel()->selectedRows();
//QString val = ui->lineEdit_5->setText(model->index(ids,0).data().toString());
QString rowdata1;
//rowdata1 = ui->tableView->model()->data(ui->tableView->model()->index(ids,0)).toString();
rowdata1 = ui->tableView->model()->data(ui->tableView->model()->index(rowdx,0)).toString();