Unsolved Creating a table with grid view adding, editing and deleting data from the MS SQL server using Qt Creator
-
Re: How to Create a Custom Context Menu For QTableView
Hi All,
I am trying to implement qt creator gui application for "creating a table with grid view adding ,editing and deleting data from the MS Sql server using Qt creator"...how to implement grid view on table can anyone guide me in right direction.... -
Hi,
Do you mean a QTableView with a QSqlTableModel ?
-
Yes using QTableview or QTablewidget with a QSqltableModel
-
where i will get the examples of the Qt grid view adding ,editing and deleting data from the MS Sql server....... i am already done the adding and editing the data from the MS Sql server using Qtableview and QTablewidget now i am trying to do using grid view as similar as C#..........
-
Do you mean something like this list in the QtSql module example page ?
-
No ...i have seen this link already but i did not understand ...you guide me how should i start grid view on qt creator using MS sql server ......
-
@veera
Hi
What is a Qt Grid View ?
Unlike QTableview and QTablewidget,
i do not know what class you mean when you say " Qt grid view" :) -
On the single window itself we can put add ,delete,edit the MS Sql table data using grid view as similar like C# they are using grid view for the same ...i am looking for the same thing need to implement......
-
Just to be sure we're on the same page, Qt Creator is an IDE, not a database editor so you are trying to build an database interface application, correct ?
-
@SGaist
Yes I agreed but i am already implemented using QTableview for editing and deleting and adding data from the mssql server existing table same thing i need to grid view for editing and adding deleting data from MSSql server with QT interface..... -
Well that's where it's not clear, AFAIK QTableView + QSqlTableModel gives you the same thing as the GridView from C#.
-
@SGaist
How should i implement data grid view using QTableview + QSqlTableModle on Qt creator?
I want to create Qt program with similar layout as C# DataGridView,Can you please provide some example code? -
Hi
Maybe you can show us a picture of a C# DataGridView ?
Like the one you want. -
-
Then it's basically a QTableView with the alternatingRowColors property set to true and a couple of QLineEdits and QPushButtons. All in a mix of QHBoxLayout and QVBoxLayout.
-
-
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.
-
I want some examples how to do it using qt gui application...
-
@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.
-
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.......