GGD-OpenSpaceNet icon indicating copy to clipboard operation
GGD-OpenSpaceNet copied to clipboard

Create a QT Log Sink

Open KevinMcGee opened this issue 8 years ago • 1 comments

We'd like to have more robust code for how the GUI handles the acquisition of progress logging. We'd like to implement a a QT Log Sink class that inherits from boost sink and QObject. We will need to implement the 3 virtual functions for boost sink in a way that when they are updated they emit a signal to the GUI to properly perform cross thread data tranfer

KevinMcGee avatar Oct 10 '16 18:10 KevinMcGee

Some advice from @avitebskiy:

you don't necessarily need to inherit from QObject, but you must inherit from the sink class (I guess it's synchronous_sink). The idea is that you can then register that class as a log sink and get all log notifications from it.

I thought you just needed to inherit from sink, not even synchronous_sink, but that's up to your implementation of course.

The workflow is that you create an instance of your sink class, then register it by calling. i.e. dg::deepcore::log::addSink(std::make_shared<QTLogSink>());

Of course, you may have some parameters and setup before you addSink, but that's the idea in its simplest form.

KevinMcGee avatar Oct 11 '16 12:10 KevinMcGee