[Qt-interest] Making the button's text bold when hovered

Oliver Demetz forenbeitraege at oliverdemetz.de
Tue Jul 7 11:01:45 CEST 2009


Hi,

I would like to display the text of my QPushButtons in *bold* when it is 
hovered. So since I am already using style sheets, here is what I 
thought should work:

MyWidget > QPushButton {
	font: 14px;
	background: transparent;
	border: 0px;
	border-radius: 0px;
	padding: 3px;
}
MyWidget > QPushButton:hover {
	background: transparent;
	font: bold 14px;
}
MyWidget > QPushButton:pressed {
	background: transparent;
	font: bold 14px ;
	color: red;
}

In my understanding, this should render the buttons without any border 
or background, and just display the text of the button. When the mous 
enters the button rectangle, the tect should become bold.

But it does not. It just stays non-bold.

Any Idea?

Thanks a lot in advance...

best regards,
Oliver



More information about the Qt-interest-old mailing list