我正在用 C++ 创建一个(伪)实时绘图应用程序,使用 gnuplot 作为绘图后端。我的要求之一是绘图必须位于现有窗口内,而不是有一个单独的绘图窗口(gnuplot 默认为)。
Gnuplot 有一个选项可以指定(Qt)小部件 ID,这似乎适合我的用例:
set terminal qt widget <id>
我尝试传递我的值QtWidget::effectiveWinId()
无济于事。
Update: 尝试使用窗口 id 的内部值QtWidget::winId()
也没有运气。
问题是我找不到任何关于什么的文档<id>
应该是。这是 gnuplot 开发者的意图吗?
这是我的代码的示例:
#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();
}
在 gnuplot 中:
gnuplot> set term qt widget <value from effectiveWinId>
gnuplot> plot x
Could not connect to existing qt widget. Starting a new one.
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)