If there is no standard way...
Here is what I know.
The normal way in Qt is that if an occurence is modified in a transaction and that another transaction accesses it, it just freezes when the model tries to carry out the update.
There are several problems with that.
1. The user does not know, before the update, if his changes will be accepted. It would be better to react at the beginning of the edition.
2. I would have preferred it if the program did not access all the time the database.
3. I have a strange bug when I am not using the "on manual submit" strategy. When I edit a cell, another in the table is randomly modified. I have posted a message here but found no solution
4. It freezes. It would be better to have an error message like when you have done a SELECT FOR UPDATE NOWAIT
I am ready to accept 1 and 2. I am desperate about 3 but issue 4 is definitely a problem. It should not freeze.
The only solution I see would be to use the "on manual submit" strategy to avoid the strange bug (cf 3) and do a SELECT FROM UPDATE NOWAIT at the beginning of every modification or when I change of occurence. But the textChanged signal is emitted each time a character is typed and I would need to place something in the createEditor function in the item delegate. This way, I will be able to set the locks and to prevent the edition in case the query fails (ie if the record is already locked). It would be more natural to detect changes at the level of the model but Isee no signals I could use or events I could override.
It seems complicated...
At least, I would be glad if I could somehow that freeze. How could I do?
And, what would be the natural way to implement the locks in Qt? I assume there something for that. I do not ask for a ready made solution. But if someone could point me to a piece of documentation, give me a class name...
Thanks!
There i
Bookmarks