PDA

View Full Version : Tooltip of widget not visible in QGraphicsProxyWidget



yagabey
12th February 2016, 17:25
Hi,

I've embedded a QCustomPlot (http://www.qcustomplot.com/)item into a container widget; and embedded this container widget into a QGraphicsProxyWidget. And i've inserted this proxywidget into QGraphicsScene. QCustomPlot 's events have some problems with QGraphicsProxyWidget. Jscurlee (http://www.qcustomplot.com/index.php/support/forum/746)' s solution fixes most of the problem. But i also needed to show a tooltip for plots and used Ross (http://www.qcustomplot.com/index.php/support/forum/277)'s solution.

As a result; i can see a tooltip box when i hover on the graph line; but texts of the tooltip are invisible as below:

11697

Now i am stuck here, any idea?

Thanks,
Yigit

anda_skoa
12th February 2016, 17:38
Maybe you can draw directly in a custom item instead of embedding a widget?

Then you wouldn't have to proxy between widgets and graphicsscene and have full control over what you do.

Cheers,
_

yagabey
12th February 2016, 17:47
Hi Anda,
Do you mean i should port QCustomPlot item into a QGraphicsPlotItem?

anda_skoa
12th February 2016, 18:05
That might be better for the long run if that is possible.

Embedding widgets into a graphics scene can get ugly, as things like events need to be mapped back and forth between two very different worlds.

A custom graphics item is usually more upfront work but you also better control on drawing and user interaction.

Usually embedding widgets makes only sense if it is one of the standard widgets, e.g. QComboBox, which are quite complicated to replicated visually and behavioralwise.

Cheers,
_

yagabey
12th February 2016, 21:42
Life would be much easier if that tooltip had worked; but anyway... :-)

Edit: I think proxy causes a palette related issue. Calling setPalette after tooltip's showText function solved the problem for now.


QToolTip::showText(helpEvent->globalPos(), ttip);
QToolTip::setPalette(QPalette(Qt::black));