问题
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