Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracking cursor C++

I'm currently working on a class that will create an x,y graph according to given parameters when called, but I also want a description of each point in the x,y graph when the cursor hovers over it.

For example, if I generate a graph displaying market growth(year, amount, rate), and I hover over a certain point, I want a little box to appear and in it will be details about that point like the year, stocks, stock prices, position in graph, etc. I already finished the graph generator, but now I need help with this part.

How do I achieve this in C++?

Note -- I'm using Ubuntu.

Another note --- I created my graph without graphical libraries, and without any graphical functions. If you didn't understand my question at first, I'm basically asking 2 things: 1. How do I implement cursor tracking to my non-graphical graph with outer graphical libraries, and 2. if not possible, which library should I use to create a graph and how do I use them for cursor tracking?

Sorry for the confusion, it's just the first time I'm using graphics. I'm more of a "no external libraries" programmer.

Thanks.

like image 915
Lockhead Avatar asked Jul 16 '26 14:07

Lockhead


1 Answers

I would opt for Qt since there is 3rd party library called Qwt based on Qt which provides quite a lot of technical widgets including plotting ones (you might also be interested in Qwt dedicated sub-forum on qtcentre).

The solution for "txt-box on hover" effect is in fact very simple, you just have to set tooltip via QWidget::setToolTip( const QString& ) for the node widgets.

like image 177
Palmik Avatar answered Jul 18 '26 03:07

Palmik