On Thu, 10 Jul 2014 15:45:08 +0100 Krisztian Olah <fasza2mob...@gmail.com> wrote:
> 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. What you describe is exactly what I would like to achieve with the next version of the program but one which uses 2 databases, one provided by an organisation called CAMRA - www.camra.org.uk and my own to record any visits to pubs and the beers I drink there. But that's some way away as I my programming ability needs to improve considerably before I can do such things! When you get to my age, these things don't come easily. Certainly they don't for me. Perhaps I should leave things as they are on this program and concentrate on the new one! _______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org