Creating a table with grid view adding, editing and deleting data from the MS SQL server using Qt Creator
-
Hi,
if you are asking how to insert buttons in the table then you are looking for a delegatehttp://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
http://www.informit.com/articles/article.aspx?p=1405547&seqNum=4
http://stackoverflow.com/questions/11777637/adding-button-to-qtableviewIf its not important that Add/Edit is on each row then some buttons to the side for add/delete is the fastest way.
-
wrote on 8 Mar 2017, 13:14 last edited by
I want some examples how to do it using qt gui application...
-
Lifetime Qt Championwrote on 8 Mar 2017, 13:40 last edited by mrjj 3 Aug 2017, 13:40
@veera
That is how.
Use delegate if you want the buttons being part of each row.
The delegate is how u do it.It is not possible to do in Designer.
-
wrote on 13 Mar 2017, 09:37 last edited by
Hi All,
i am using qt creator for adding ,save and delete the data from table ,here i am using QtTableview and i am not able to delete the particular row using push button method on qt and mssql server....... -
What code are you using currently to modify the content of the database ?
Like stated before Qt Creator is just an IDE, you'll have to write a minimal amount of code to interact with your database.
-
What code are you using currently to modify the content of the database ?
Like stated before Qt Creator is just an IDE, you'll have to write a minimal amount of code to interact with your database.
wrote on 13 Mar 2017, 10:52 last edited by@SGaist
for inserting the data
query->prepare("INSERT INTO Entry2 (name,contact,lastname,id,emailid)" "VALUES(?,?,?,?,?)");
showing the data after editing
model->setQuery("SELECT *FROM Entry2");
ui->tableView->setModel(model);
for the same thing for deleting a particular row from the table? -
@SGaist
for inserting the data
query->prepare("INSERT INTO Entry2 (name,contact,lastname,id,emailid)" "VALUES(?,?,?,?,?)");
showing the data after editing
model->setQuery("SELECT *FROM Entry2");
ui->tableView->setModel(model);
for the same thing for deleting a particular row from the table? -
Why not use QSqlTableModel ?
-
wrote on 15 Mar 2017, 07:56 last edited by
yeah i tried using QSqlTableModel ,here below code instead of passing row on model.setFilter ,need to pass from UI using pushbutton method whichever row i can delete using delete push button method in a generic way....
model.setTable("Entry");
model.setFilter("id = 1");
model.select();
if (model.rowCount() == 1) {
model.removeRows(0, 1);
model.submitAll();
} -
wrote on 15 Mar 2017, 11:27 last edited by
Hi All,
I want to develop this type of grid view like after clicking edit button for each row of table please refer this link
"http://www.c-sharpcorner.com/uploadfile/1e050f/edit-and-update-record-in-gridview-in-asp-net/" .....guide me for implementing same grid view using Qt and MS Sql server..... -
wrote on 16 Mar 2017, 13:51 last edited by
Hi All,
How can i use QML grid view for implementing my grid view control please any one guide ....
-
wrote on 20 Mar 2017, 05:26 last edited by
Hi
If anybody having the idea to implement grid view on QT 4.8 version and MS SQL Server (Ubuntu 16.04 LTS)........please share your ideas......... -
This post is deleted!