views:

167

answers:

5

First, I'm using Qt at the moment. However, I want the program eventually able to run without a GUI environment, leaving the graphical aspects for configuration mainly. The program makes hefty use of Qt timers and signals/slots, partially for QtScript. So if I want to make it non-GUI operable, hopefully parts of Qt can run without a GUI environment. If not, maybe I'll look into a different Javascript implementation, although QtScript is very convenient how it integrates into Qt's and C++'s OO structure. First, can parts of Qt be used in a non-GUI environment, and if not what other choices are there as far as an events and scheduling library? Preferably OO design.

+2  A: 

libevent may be what you are looking for. This is in C, however.

The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.

Alex B
+3  A: 

Have you looked at the Boost.Signals library? (I haven't used it myself.)

sbi
+2  A: 

libsigc++ has a signals and slots mechanism very similar to Qt's though it's pure C++ (no extra pre-processor). It can also be used with gtkmm, a C++ binding for GTK+.

That said, I'd be surprised if Qt requires that you have a GUI, so you'll probably be able to stick with Qt.

Laurence Gonsalves
+4  A: 

If you don't use the QtGui module, you don't need a GUI. QtCore etc. will work just fine.

Jurily
+1  A: 

The Poco project offers two interesting solutions:

The Boost signals library is very nice too, but it's one of the few boost libraries that need to be built and linked with.

StackedCrooked