PDA

View Full Version : Blackbox button tooltip



jeanremi
13th January 2012, 12:59
Hi

I have subclassed a qpushbutton (following this link: http://www.qtcentre.org/threads/44299-Widget-showing-up-without-a-transparent-background-in-QGraphicsView?highlight=pawn2-%26gt%3B)
and set its background-color to transparent via setStyleSheet("background-color: transparent;);
but this causes the tool tip of this button to appear as a black box. Without this, it works fine.

setAutoFillBackground is set to false (but I don't think this is the reason for this problem) - it doesn't affect the tooltip.

Any ideas?

Thanks,

Jean

woswoasi
20th January 2012, 12:29
Hi,

do not use

widget->setStyleSheet("background-color: transparent;");

use

QPalette palette = widget->palette();
palette.setColor(widget->backgroundRole(), QColor(0, 0, 0, 0));
widget->setPalette(palette);

Peter

jeanremi
21st January 2012, 21:14
Hi Peter

Thanks for your reply.

Your suggestion does restore the tooltip but the background then appears on buttons of irregular shapes such as rounded shapes (circled buttons). The tooltip is restored, but the transparency fails...

I still haven't resolved it and decided not to use tool tips (well at least this way all buttons are properly displayed with transparent backgrounds).

Any more ideas, always welcome.

Cheers.

Jean