Hi Everyone,
I have a QDataTable in way readonly, would like that when I executed a double click in the desired Item, insert of the same made one in database.
It is possible.
http://200.193.29.195/qt/vtr.png
Hi Everyone,
I have a QDataTable in way readonly, would like that when I executed a double click in the desired Item, insert of the same made one in database.
It is possible.
http://200.193.29.195/qt/vtr.png
But what is the question? Is it possible? Maybe Depends if you have all the data to construct a valid query to the database.
Yes, this is possible.
To quote the documentation of QDataTable:
See: http://doc.trolltech.com/3.3/qdatatable.html#details (Qt 3.3).When displaying editable cursors, cell editing will be enabled. (For more information on editable cursors, see QSqlCursor). QDataTable can be used to modify existing data and to add new records. When a user makes changes to a field in the table, the cursor's edit buffer is used. The table will not send changes in the edit buffer to the database until the user moves to a different record in the grid or presses Enter. Cell editing is initiated by pressing F2 (or right clicking and then clicking the appropriate popup menu item) and canceled by pressing Esc. If there is a problem updating or adding data, errors are handled automatically (see handleError() to change this behavior). Note that if autoEdit() is FALSE navigating to another record will cancel the insert or update.
I don't know much about Qt 3, but I wouldn't be surprised if it comes with a demo that shows how this is done.
Bookmarks