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.
views:
167answers:
5libevent
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.
Have you looked at the Boost.Signals library? (I haven't used it myself.)
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.
If you don't use the QtGui module, you don't need a GUI. QtCore etc. will work just fine.
The Poco project offers two interesting solutions:
- Notification center: based on Cocoa/OpenStep's NSNotificationCenter
- Events and delegates
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.