PDA

View Full Version : Qt 4.6 in Windows XP -- Tooltips Sometimes Appear with No Text -- Why? How to fix?



CSeggelin
31st August 2012, 21:32
Tooltips are not rendering properly in Win XP (sometimes). I'll hover over a button, and I will see the appropriate tooltip, then a moment later I will hover over it again and a blank tooltip will come up. The tooltip continues to be wide enough to display all the text that is in it, although its height seems to have reduced by 50% and there doesn't appear to be any text in it. I am using a stylesheet for tooltips which looks like this:



QToolTip {
border: 2px solid darkkhaki;
padding: 5px;
border-radius: 3px;
opacity: 200;
color: black;
}

It's very annoying and I can't seem to get it to work reliably. I am not using a custom QToolTip object.

Note: when I build my app and run it in CentOS the tooltips always work. When I build it and run in it Windows XP tooltips only occasionally work.

Thanks in advance for any help you can offer. If this is a known bug, is there a workaround? Otherwise I am just going to have to shut off all the tooltips in my application.

ChrisW67
31st August 2012, 23:36
Have you tried removing your style sheet as an experiment?

CSeggelin
1st September 2012, 02:10
I've tried removing the style for the QToolTip but not the style for the entire screen. I can give that a shot though.

CSeggelin
6th December 2012, 19:35
It's been a couple months but I have finally gotten back to looking at this bug, and I have learned more. This appears to be a Qt Bug. Qt appears to be *sometimes* computing the size of the tooltip box *before* the styles have been applied. So if I specify a red border and no other styles, my tooltips appear fine every time. But if I add, say 10px of padding, the tooltip box now appears blank because it hasn't been sized to be big enough to accommodate the font plus 20 additional pixels of width and height, and as a result, none of the text actually renders inside the tooltip box. This only appears to happen in WinXP.

The only workaround available to me is to remove all tooltip styling. It's the only way I can ensure that the application can properly render the tooltips whether I build it in CentOS or Win XP.

Occasionally Qt properly computes the tooltip size correctly, and then I can see the tooltip, but it is sporadic and random--I might mouse off of a control and then mouse back on and suddenly the tooltip appears wrongly sized and blank when it was visible just moments before.

Other people reporting similar problem:

https://bugs.launchpad.net/mixxx/+bug/712718

prof.ebral
7th December 2012, 20:30
You can setGeometry for the tool tip to give it extra padding.