<div dir="ltr"><div><div><div><div><div><div><div><div><div>First off, you should place each class to its own heeader and source file to reduce future compile time. When you change only one class<br></div> you won't have to recompile everything thus it's easier to find the classes.<br>
</div><br>You should use one of the Qt Sql Model classes:<br><a href="http://qt-project.org/doc/qt-4.8/sql-model.html">http://qt-project.org/doc/qt-4.8/sql-model.html</a><br></div><br></div>something like:<br><br></div>logic <-------> qml<br>
</div>logic <-------> databaseManager<br></div>databaseManager <-------> databaseModel<br></div><div>view <-------> databaseModel<br></div><div><br></div>logic has a member function/slot to return a pointer to the model that<br>
qml displays in a view.<br><br></div>logic also has a function/slot that takes the required data from qml that is needed to add a new entry in the database. This function invokes a member function of databaseManager that does the real work, hence only databaseManager touches the database the view will interact with the model to which it has a pointer from logic which in turn asks for the pointer from databaseManager. When a new entry is added databaseManager updates its model that emits the needed signals that informs any connected views about the changes.<br>
<div><div><br><div><div><br><br><br></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 10 July 2014 15:14, <span dir="ltr"><<a href="mailto:sfietkonstantin@free.fr" target="_blank">sfietkonstantin@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, looking a bit at your code, you are using a pagestack.push, meaning that you effectively adds another page to your pagestack.<br>
<br>
For adding a new beer, I think that the best would be using a Dialog component.<br>
<br>
----- Mail original -----<br>
De: "Chris Walker" <<a href="mailto:cdw_nokiaqt@the-walker-household.co.uk">cdw_nokiaqt@the-walker-household.co.uk</a>><br>
À: <a href="mailto:devel@lists.sailfishos.org">devel@lists.sailfishos.org</a><br>
Envoyé: Jeudi 10 Juillet 2014 15:53:10<br>
Objet: Re: [SailfishDevel] Pagestack problems<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, 10 Jul 2014 19:45:28 +0600<br>
Andrey Kozhevnikov <<a href="mailto:coderusinbox@gmail.com">coderusinbox@gmail.com</a>> wrote:<br>
<br>
> you do not need to reload page, so there wouldn't any navigation<br>
> problems at all :)<br>
<br>
I'm afraid you have me thoroughly confused now.<br>
<br>
Can you do me a favour and take a look at my code and let me know where<br>
I'm going wrong and what I should be doing?<br>
<br>
It's here - <a href="https://github.com/tonercloud/beertent/tree/master/beertent" target="_blank">https://github.com/tonercloud/beertent/tree/master/beertent</a><br>
<br>
The only change I've made since I uploaded that is to add #include<br>
<QQmlContext> to beertent.cpp<br>
<br>
Ta.<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></div></div></blockquote></div><br></div>