[Interest] saving data using QtSql during shutdown

Francisco Ares frares at gmail.com
Thu Dec 19 14:07:07 CET 2013


Found it:

QApplication::commitData(QSessionManager * manager)

All you have to do is derive QApplication with the above function
explicitly doing what you need to do at the system shutdown, replace
QApplication at main() for this new derived class, and that's it.

I've tested under Linux, Qt 4.8.5, it works perfectly (closing the window
manager session, that member function is called).

Best regards,

2013/11/11 Thiago Macieira <thiago.macieira at intel.com>

> On segunda-feira, 11 de novembro de 2013 10:16:18, Francisco Ares wrote:
> > Hi,
> >
> > I am finishing an embedded system, using Linux and Qt as the base of the
> > application that manages the system, and as a manager to a SQLite
> database
> > for this application.  As it will be using a flash SATA module, I would
> not
> > like to do many and frequent write operations to it.
> >
> > So, I would like to know, on a ACPI shutdown request, how to safely
> commit
> > the remaining data to the database.
> Make the ACPI shutdown request cause some noticeable change in the
> application
> state. For example, a SIGTERM, which you can catch and cause the data to be
> saved.
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131219/416d77a8/attachment.html>

More information about the Interest mailing list