[Qt5-feedback] Add QtService to Qt proper

Craig.Scott at csiro.au Craig.Scott at csiro.au
Thu May 19 00:46:50 CEST 2011


On 19/05/2011, at 4:20 AM, BRM wrote:

> QtService is presently only supported via an add-on to Qt. I would be very 
> helpful to have it be part of the official Qt instead of an add-on - e.g. it's 
> distributed with Qt just like QtGui.
> It could also use some TLC, for example:
> 
> - QtService is presently a set of template classes, making use of Signal/slots 
> hard. It could probably be better done using Abstract classes to define the 
> interface.
> - It would be useful to schedule shutdown as opposed to having the '-t' option 
> simply terminate it; probably '-t' should be "--force-shutdown" instead.
> - The "Interactive Service" functionality could probably be removed given that 
> (i) adding GUIs to services is not adviced, and (ii) Windows no longer supports 
> it (as of Vista). Other platforms may but we probably should follow best 
> practices and encourage developers to split the service from the GUI.


I very much agree with this, and given that the move to Qt5 is going to have binary compatibility breaks, it would seem to be an opportune time to really consider bringing an improved/restructured QtService class into Qt proper. I agree with Ben's view that the current templated approach is both unnecessary and a hinderance. Dispensing with the GUI support should make for a much cleaner class, and as Ben pointed out, a GUI should really be split from the service itself anyway. QtService is one of those things that I find myself asking "Why isn't this part of the main Qt libraries already?". It makes sense and fits nicely with the other set of classes provided by Qt. I put it at a similar level as QDesktopServices, QProcess and QSharedMemory.

One of the trickier bits of using QtService at the moment is if you want to support additional command-line options beyond those defined by QtService. This is hard enough to do robustly that we basically don't want to do it and instead work around it. Maybe the command-line handling should be done separately from the QtService class and have QtService provide member functions to do the equivalent instead? FWIW, we ended up implementing our own generic (and extensible) command line argument processing class for some other work, so we have the other half of this picture. I could understand if others would be less keen to forego the bundled command-line capabilities within QtService as it is currently implemented.

--
Dr Craig Scott
Computational Software Engineering Team Leader, CSIRO (CMIS)
Melbourne, Australia





More information about the Qt5-feedback mailing list