[Qt-interest] How to animate the color of a QLabel
Malyushytsky, Alex
alex at wai.com
Fri Jan 7 23:48:49 CET 2011
Sent first version too soon, so fixed some logic below:
I have not tested it, but you can change text color using html tags:
pLabel->setText("<font color="red">Labeltext</font>")
and text is defines with Q_PROPERTY
So I don't see why you would not be able to use QPropertyAnimation.
Just change tags around text?
Alex
-----Original Message-----
From: qt-interest-bounces+alex=wai.com at qt.nokia.com [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of André Somers
Sent: Friday, January 07, 2011 11:51 AM
To: wilhelm.meier at fh-kl.de
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] How to animate the color of a QLabel
If you don't want to subclass QLabel, you could use a stylesheet on the label, and just use that to set a new color for each step in the animation.
André
Verstuurd vanaf mijn iPhone
Op 7 jan. 2011 om 18:14 heeft Wilhelm <wilhelm.meier at fh-kl.de> het volgende geschreven:
> Hi,
>
> this is a simple question, I guess, but I can't get the right answer:
>
> I have a QStateMachine with some transitions. One of these transitions
> sets the status of a QLabel from enabled to disabled. And now I want to
> animate this change with an animated color.
>
> I tried to use a QPropertyAnimation for this transition, but the QLabel
> has no property color. It has only palette, but I can't animate the
> palette in some way (I think, the type QPalette isn't supported by
> QPropertyAnimation).
>
> I would like to change the color of the label text from the default
> active color to the default inactive color with some different color a
> some keyvalues of the animation.
>
> Any hints?
>
> --
> Wilhelm
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list