[Interest] Design idioms for QtCore applications

Thiago Macieira thiago.macieira at intel.com
Fri Feb 8 16:53:40 CET 2013

On sexta-feira, 8 de fevereiro de 2013 10.15.39, K. Frank wrote:
> Well, truth be told, I'm not trying to do anything.  Or, more seriously,
> I'm trying to learn, so that I get a sense of the Qt-approved way of doing,
> so that I get a sense of what one can do with non-gui Qt apps and
> when I might want to use them.

Writing a server application, that handles sockets and runs forever (until it 
receives a Quit command) is quite supported. All you need is to instantiate 
your server class, that opens the necessary server sockets, in your main 
function, like you would your main window. Then exec() in the 
QCoreApplication. Those are no-UI applications.

Using stdin is not, as you put it, "Qt-approved". Those aren't no-UI: they 
have a user interface, it's just text mode. Qt has no support for TUI.

> That is, I'm just playing around right now.
> The kind of thing I'm thinking of, hypothetically, is some kind of server
> that responds to events coming in over a socket (maybe sometimes
> writing to that or another socket), but also responds to commands
> typed into the console.  (These might be more along the lines of
> management-control commands.)  So the first thing I thought I might
> try is to build a toy app that uses the event loop, but responds initially
> only to command-line input.

I'd design that so the management console is a separate, GUI application that 
connects to the server via socket and is able to acquire the privilege of 
sending management commands via authentication. Your server application would 
have no direct UI.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130208/ea257969/attachment.sig>

More information about the Interest mailing list