<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello Francoise,<br>
<br>
I find your code a bit hard to read. It would be nice if you use
full names like list instead of l. I know it is annoying, but makes
live easier in the long run.<br>
<br>
Why do you have more then one Remorse? This is not clear to me.
Maybe you can explain?<br>
Where do you close your db connection? - May I have overlooked this
:(<br>
Could not find the method Match in the documentation or in the code
:(.<br>
<table class="highlight tab-size js-file-line-container"
data-tab-size="8">
<tbody>
<tr>
<td id="LC40" class="blob-code blob-code-inner js-file-line">
QModelIndexList l = <span class="pl-v">this</span>-><span
class="pl-c1">match</span>(</td>
<td id="LC41" class="blob-code blob-code-inner js-file-line">
<span class="pl-v">this</span>-><span class="pl-c1">index</span>(<span
class="pl-c1">0</span>, <span class="pl-c1">0</span>),</td>
<td id="LC42" class="blob-code blob-code-inner js-file-line">
MModel::IdRole,</td>
<td id="LC43" class="blob-code blob-code-inner js-file-line">
itemId,</td>
<td id="LC44" class="blob-code blob-code-inner js-file-line">
<span class="pl-c1">1</span>,</td>
<td id="LC45" class="blob-code blob-code-inner js-file-line">
Qt::MatchExactly);</td>
<td id="LC46" class="blob-code blob-code-inner js-file-line"><br>
</td>
</tr>
</tbody>
</table>
<br>
I check against <a class="moz-txt-link-freetext" href="http://doc.qt.io/qt-5/qsqltablemodel.html">http://doc.qt.io/qt-5/qsqltablemodel.html</a> What is
your reference?<br>
<br>
SQLLite may only support multiple readers or one writer. Maybe this
is your Problem?<br>
<br>
I would honestly have One Data Object that knows how to read from
the DB and open and closes the Connection for each operation with
the DB seperatly.<br>
Not sure if this solves you Problem but it makes it easier to debug
and Maintain. (Maybe Code is slower... But I rather have a rugged
Code then a fast one.)<br>
<br>
I would think in Layers:<br>
USER<br>
VIEW<br>
APPDATAMODEL<br>
DATABASE CONNECTOR<br>
DATABSE<br>
<br>
Hope this helps you a bit.<br>
<br>
All the best<br>
Peter<br>
<br>
<br>
<div class="moz-cite-prefix">On 28.12.2015 21:59, François K. wrote:<br>
</div>
<blockquote
cite="mid:2095718757.524653362.1451336358687.JavaMail.root@zimbra76-e14.priv.proxad.net"
type="cite">
<pre wrap="">Hello,
I sent the following email a few weeks ago but got no answer. The github statistics also show that only one person downloaded the "dummy" project I wrote to demonstrate my issue... :(
With the recent announcements and the Jolla boat sailing on, I'd like to get this solved.
I'm even willing to pay if necessary.
Thanks a lot,
All the best,
----- Mail original -----
</pre>
<blockquote type="cite">
<pre wrap="">
I have a model that inherits from QSqlTableModel. A SilicaListView
shows the data. This is very easy to do, thanks to Qt/QML :)
Each list item has a ContextMenu with a "Delete" entry that allows
the user to delete the item. It runs a remorse, and, at the end of
the remorse, the item is deleted from the model (and the database).
Again, this works quite well... until you try to delete several items
at the same time
A QSqlTableModel can have 3 different edit strategies :
OnManualSubmit, OnRowChange or OnFieldChange.
If I set it to "OnManualSubmit", the item is deleted from the model,
but it remains in the view and in the database until I call
QSqlTableModel::submitAll(). This method actually commits the
changes to the database, and resets the model by calling
QSqlTableModel::select(). Since the model is resetted, it loses all
other running remorses and causes a segfault.
If I set it to "OnFieldChanged", the item is deleted from the model
and from the database, but it will still remain visible in the view.
According to the Qt doc, I should call select() to update the view.
But, as we've seen before, this destroys the other running remorses
and also causes a segfault.
I've made a very small app to demonstrate the problem, you can get it
here and try it in your emulator : git clone
<a class="moz-txt-link-freetext" href="https://github.com/Frzk/dummy.git">https://github.com/Frzk/dummy.git</a>
You can use the PullDownMenu to switch between OnManualSubmit and
OnFieldChanged strategies.
How should I deal with this ? This is a very simple case, yet I can't
seem to find a solution :(
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<br>
</body>
</html>