[Qt-interest] Submitting changes in a QTableView
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Mon Jul 13 16:18:25 CEST 2009
I had the exact same issue.... here is how I wound up solving it.
In my custom delegate, I keep trac of the current editor being edited.
Updated in the createEditor command, and kept up to date with a slot
connected to its destroyed slot.
When the tool button is clicked, in the slot, I emit a signal first that
is connected to the delegate to "forceCommit" which is a slot on the
delegate that checks the current editor, and if valid, emits a signal
connected to "commitData" on the view.
It works, but Im not sure if it's the best solution ;) I have used it
in a number of editable models.
Soctt
-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Lars Amsel
Sent: Wednesday, July 08, 2009 7:44 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Submitting changes in a QTableView
Hi,
I have a QTableView with an editable model that is derived from
QAbstractListModel. Furthermore there is toolbar button that should do
some
calculations with the values of the table view. Because the toolbar
button is
not focusable the table doesn't loose the focus and the current edited
value
is not commited to the model.
How do I ask the table to stop editing and commit remaining changes?
Sure I
could send a return key to the current editor, but that doesn't seem to
be the
most elegant way.
regards
Lars
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list