[Interest] Design idioms for QtCore applications
K. Frank
kfrank29.c at gmail.com
Fri Feb 8 17:18:56 CET 2013
Hi Thiago!
On Fri, Feb 8, 2013 at 10:53 AM, Thiago Macieira
<thiago.macieira at intel.com> wrote:
> 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.
Thank you. This all makes good sense.
> 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's good to know. So I should plan not to use the console, or if
I do use the console, I should expect any attempts to integrated it
with the Qt (non-gui) event loop to be complicated or look hackish.
>> ...
>> 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.
Yes, I very much agree with this architecture for an
industrial-strength solution.
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
I appreciate you advice.
K. Frank
More information about the Interest
mailing list