PothosGui: created basic control widgets

Created control widgets

The pothos-widgets project now contains several new basic control widgets. These new widgets demonstrate the capability to create widget-aware blocks and interact with them in the PothosGui. The list includes:

  • a slider that deals with floating point values,
  • a numeric entry for floating point values,
  • a drop down selector based on QComboBox,
  • a radio group selector based on QRadioButtons,
  • and finally, a display only label widget.


Development went very smoothly, with the exception of something that I didnt consider... thread contexts. QWidgets like to be dealt with in the main application thread. However, the Pothos::Block has its own separate threadpool to handle the Actor. This means, the QObject slot is in the wrong thread context to make calls on the Pothos::Block. And the Pothos::Block slot is in the wrong context to make calls on the QObject.

A quick fix

Basically, we cheated... because we can make some assumptions about what is atomic to make this problem easier:

  • The actor thread doesnt have to compete with the QThread because the actor thread is causing all the stimulus.
  • Emitting signals from the wrong thread context is safe, or can be made to be safe.

We only had to go out of our way to call into the QObject from the correct thread context when that call created a new QObject. Otherwise, the new obejct would be incorrectly parented under another thread and would not display. For this particular case, we can call directly into a slot on our QObject, which will be handled in the correct thread context:

QMetaObject::invokeMethod(this, "setText", Qt::QueuedConnection, Q_ARG(QString, text));

A little ugly. But its actually really nice, and really powerful. Thanks Qt!

A proper fix

Lets make Pothos more veratile and allow blocks to be handled by arbitrary thread contexts that are created outside of the Pothos Framework. This will nicely fix the above issues without any workarounds, or atomic assumptions. See block actor support arbitrary thread context #66. But I will probably hold-off on addressing this issue immediately. In the near future, the entire threading system will be cleaned up and revamped -- a good opportunity to take care of this issue as well.

QWT widgets

QWT is a set of plotting and control widgets based on Qt. We plan on using QWT to create some basic plotters, and to wrap some of its neat controls like dials and compases) into GraphWidgets as well.

We have included the complete source of QWT into pothos-widgets after having terrible ABI issues with the ubuntu development install for QWT. Including the source isnt that bad in any case... the source is rather small, and actually very simple to build. In addition, since there doesnt seem to be any prebuilt QWT for windows, this will allow us to deploy Pothos on Windows systems with less dependency trouble.

Last edited: Wed, Aug 20 2014 - 12:10AM