Worktask scheduling library implemented with C++ and Qt

Worktask scheduling library implemented with C++ and Qt

SAuto – Opensource library for worktask scheduling



In the Qt programming framework, there are many tools for initializing tasks. The signal/slot mechanism is very good for tailoring objects together to form an application. Some signal is sent from some object, because some condition was met. The signal is received in a slot another place in the program to react accordingly to the condition.

Then there is the QTimer, which basically is a clock that sends a signal automatically when started, at predefined intervals. This is very useful in many circumstances. You can even send a single signal from a QTimer::singleShot, delayed by a predefined amount of milliseconds.

The SAUTO library takes this functionality even further. It will let you choose intervals of time, when you want selected worktasks to be initialized in sequence. There are user-interfaces for defining such intervals. A set of intervals is defined as a schedule and SAUTO contains functionality to save schedules to XML files and load schedules from XML files so that they may persist, and may be used for other APIs.

I also made a test-application so that you can more easily check it out. Everything is available for you on


on an LGPL license. Let’s have a closer look at it. When you launch the testing application, this is the first thing you see :


colored lamps

It is a simple widget with 3 colored-lights and one lightswitch for each light. Clicking the switch below the green light when it says ‘on’ will switch the light off, and clicking it when it says ‘off’ will turn it on, and so forth. So with this interface there are 6 things you can do :

  1. Turn green light on
  2. Turn green light off
  3. Turn yellow light on
  4. Turn yellow light off
  5. Turn red light on
  6. Turn red light off

These worktasks can be carried out by clicking at the switches. Sauto gives another way of carrying out these tasks, and actually any task that you wish. Clicking on the button that says ‘SAUTO’ will bring up a dialog for defining a schedule for these tasks. There are 4 different ways for doing this, and they are not mutually exclusive :

  • Timer : Define an interval for initializing tasks. You can chose to do up to 4 different tasks in sequence.
  • Day : Define one or several intervals on a clock. Within an interval you can have a Timer.
  • Week : Define which Days in a week you want to initialize tasks
  • Calendar : Define which Days for each month

As an example, take a look at the image below :



Here, we can see that on the 3,4,5,6,7,8,12,16,19,22,26 and 30th of august, between 08:01 and 16:00, at sequences that last 1 hour, then :

  • At a quarter past : Turn red light on
  • At half past : Turn red light off again
  • At a quarter to : Turn yellow light on
  • At the hour : Turn yellow light off


After you have defined your schedule, you give it a name and save it. It will be stored as an XML file. You can have as many schedules as you want at the same time.

The class that handles the schedules, is in a different library that depends on only the Qt Core libraries. Every time a worktask triggers, it sends a signal containing a string with the task to be performed. For example “redOn”. Now, it is up to the programmer to connect to this signal, and implement the needed functionality. For this example, I simply turn lights on and off. That is not so useful, but it’s just to demonstrate the concept. The worktask may be anything the programmer wants it to be. The class will also send signals to inform how long until the next interval starts, and if an interval has started, how long until the next worktask in this interval, and for how much longer the interval will run.

So, as I said already this is opensource, go ahead and check it out at


I would be very happy to hear if this would be useful for someone, and I’ll gladly answer any questions in the comment section.

Happy coding 🙂

Leave A Comment

Your email address will not be published. Required fields are marked *