[Qt-interest] Tooltip inheriting widget style - how to prevent ?

J-P Nurmi jpnurmi at gmail.com
Tue Apr 27 15:31:13 CEST 2010


On Tue, Apr 27, 2010 at 4:22 PM, Stephen Collyer
<scollyer at netspinner.co.uk> wrote:
> I have code like so:
>
> QPushButton* play_button = new QPushButton(number);
> play_button->setToolTip(tr("Play %1 audio for paragraph
> %2").arg(language).arg(number));
>
> QString style;
> style.append("border: 2px solid #8f8f91; border-radius: 6px;");
> ...
> play_button->setStyleSheet(style);
>
> The tooltip for play_button inherits the style set for play_button.
>
> Can anyone suggest a straightforward way to prevent this ?
>

Hi,

You can use appropriate selectors:
http://doc.qt.nokia.com/4.6/stylesheet-syntax.html#selector-types

--
J-P Nurmi



More information about the Qt-interest-old mailing list