gnuplot qt: hyperlinks and click events

大兔子大兔子 提交于 2020-12-13 04:04:11

问题


Some terminal supports hypertext. When hover a data point, some text is shown, e.g.

$data <<EOD
1.2 0.12 Berlin
2 0.83 Paris
3 0.6 London
4.3 0.5 Rom
EOD

plot $data w labels hypertext

Is there a possibility to have interaction, i.e. bind a click event to print the text on console or execute a hyperlink? It's likely possible with svg, but with qt console?


回答1:


The current qt implementation sends the hypertext string to the clipboard on mouse click. How to retrieve it from the clipboard depends on your desktop configuration. The classic X11 behavior was that middle-mouse-click would paste from the clipboard to the active window, but these days that expectation is often in vain.

In case it helps you to pin down the behavior on your system, the Qt command issued is this:

QApplication::clipboard()->setText(m_selectedHypertext);

The wxt terminal does essentially the same thing, with the added wrinkle that wxWidgets can have multiple back-ends that may interpret "clipboard" in different ways. There the command executed is

wxt_set_clipboard(wxt_display_hypertext);

As you suggest, the svg implementation uses javascript. You could modify the file gnuplot_svg.js to customize it however you like.



来源:https://stackoverflow.com/questions/61922390/gnuplot-qt-hyperlinks-and-click-events

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!