how to load enter data in qtable view?
-
This post is deleted!
-
-
-
Write your model, with columns
quantity
,rate
,total
,product name
. You might use a custom model, aQStandardItemModel
or aQSqlTableModel
if you are using an actual database. Store the numeric columns to hold numbers, not strings. -
Add a
QTableView
for the model. Alternatively, you could make it aQTableWidget
, in which the case model mentioned in #1 will already be attached to it (QTableWidget
has its own inbuilt model). -
Get that working to display whatever rows the table has.
-
Easiest is if you add something like
QPushButton
just below (not inside) the table. Clicking it adds a new, blank row at the end of the table, for a new item. Or have dedicated widgets for the user to pick what he wants and a button to add that as the row. There are other ways too. -
(Probably) extend the
QTableWidget
/QTableView
to allow columns Modify and Remove with their own buttons against each row.
For adding/modifying you have a choice: you can have dedicated widgets outside the table where you copy rows/do your editing, or you can make your
QTableWidget
/QTableView
allow editing in selected row, changing values inside the actual row.That's the outline.
-