PothosGui: merged widgets support Sat, Aug 16 2014 AM
Widgets supported
From a framework standpoint, blocks that contain QWidgets are now fully supported by the GUI tool. Blocks with arbitrary parameters, signals/slots, and IO ports can be instantiated in the GUI. The QWidget associated with that block can be instantiated in the editor, moved, resized. And multiple graph pages allow us to create graph widget only pages with no topological elements.
To create a widget-aware Pothos::Block; simply create a block with a registered call named "widget" that returns a QWidget pointer, and set |mode graphWidget in the block description. Thats it! What a block can put in the widget is up to the user. A slider, a text box, and complicated plotter with a panel full of knobs... The widget could even have a button to deploy a full-screen plotter.
Challenges
Auto-hiding QSizeGrip
By far the most difficult and challenging thing here was the automatically hiding QSizeGrip. QSizeGrip is provided by Qt as a resize handle for windows, and it works great, but I didnt want any of the resize handles taking up space when not being used. Getting the grip to pop in and out of visibility without disturbing the size of the display widget was in no way obvious, but at the end of the day, its not much code either.
Affinity support
Pothos doesnt really care about where your blocks are instantiated. Any process, any host... as far as its concerned, there just needs to be a handle to an RPC object. However, the QWidgets and their associated blocks have to created in the same process as the GUI. So, widget-aware blocks, cannot have their affinity zones changed, and there is a special case in the TopologyEngine to force the ProxyEnvironment for these blocks to be in the GUI process.
The following issues will expand on this in the future:
- https://github.com/pothosware/pothos-gui/issues/49
- https://github.com/pothosware/pothos-gui/issues/48
What's next?
Those ugly demo widgets in the screenshot have to go! We will start filling in the pothos-widgets component with some core useful widgets. Also, the following projects have some nice polished-looking display widgets that we will be wrapping into Pothos Blocks: