I am creating a (pseudo) real-time plotting application in C++, using gnuplot as my backend for plotting. One of my requirements is that the plot must be inside an existing window, instead of having a separate plot window (which gnuplot defaults to).
Gnuplot has an option to specify the (Qt) widget ID which seems like this would fit my use case:
set terminal qt widget <id>
I tried passing the value inside my QtWidget::effectiveWinId() to no avail.
Update: Tried using the internal value of the window id QtWidget::winId() with no luck as well.
The problem is that I cannot find any documentation on what <id> is supposed to be. Is this what the developers of gnuplot intended?
Here's an example of my code:
#include <QtWidgets/QApplication>
#include <QtWidgets/QWidget>
#include <QtNetwork/QLocalSocket>
int main()
{
QApplication app(argc, argv);
QWidget win(nullptr, Qt::Window);
QWidget *window = win.window();
win.show();
std::cout << "effective win id: " << window->effectiveWinId() << "\n";
std::cout << "effective win id: " << win.effectiveWinId() << "\n";
return app.exec();
}
In gnuplot:
gnuplot> set term qt widget <value from effectiveWinId>
gnuplot> plot x
Could not connect to existing qt widget. Starting a new one.