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
 you won't have to recompile everything thus it's easier to find the
classes.

You should use one of the Qt Sql Model classes:
http://qt-project.org/doc/qt-4.8/sql-model.html

something like:

logic <-------> qml
logic <-------> databaseManager
databaseManager <-------> databaseModel
view <-------> databaseModel

logic has a member function/slot to return a pointer to the model that
qml displays in a view.

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.






On 10 July 2014 15:14, <sfietkonstan...@free.fr> wrote:

> Hello, looking a bit at your code, you are using a pagestack.push, meaning
> that you effectively adds another page to your pagestack.
>
> For adding a new beer, I think that the best would be using a Dialog
> component.
>
> ----- Mail original -----
> De: "Chris Walker" <cdw_noki...@the-walker-household.co.uk>
> À: devel@lists.sailfishos.org
> Envoyé: Jeudi 10 Juillet 2014 15:53:10
> Objet: Re: [SailfishDevel] Pagestack problems
>
> On Thu, 10 Jul 2014 19:45:28 +0600
> Andrey Kozhevnikov <coderusin...@gmail.com> wrote:
>
> > you do not need to reload page, so there wouldn't any navigation
> > problems at all :)
>
> I'm afraid you have me thoroughly confused now.
>
> Can you do me a favour and take a look at my code and let me know where
> I'm going wrong and what I should be doing?
>
> It's here - https://github.com/tonercloud/beertent/tree/master/beertent
>
> The only change I've made since I uploaded that is to add #include
> <QQmlContext> to beertent.cpp
>
> Ta.
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to