Tooltip background?
-
I've set a tooltip on a QDockWidget title bar widget (a QLabel). The label has a gradient as a background. The tooltip is displayed with a background that seems to be derived from the background I specified for the label but it renders the tip very hard to read.
How can I get the tooltip to display without that background it has invented for itself (or with the same one as the label)?
Thanks D.
-
@Perdrix How do you set a gradient for the label? Through a palette brush, stylesheet, custom paint? If it's through a stylesheet it's just a question of scoping it to the label only.
For example if you do"color: red"
it will apply to the widget and all its children, including the tooltip, but if you do"QLabel { color: red }"
it will only apply to the label or"QToolTip { color: red }"
only to the tooltip. -
That was it! Changing the code to read:
dockTitle->setStyleSheet(QString::fromUtf8("QLabel {" "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, " "stop:0 rgba(138, 185, 242, 0), stop:1 rgba(138, 185, 242, 255))}"));
solved the problem.
Big thank you!
D.