[SailfishDevel] Silica issue on coverpage: Opacity value is ignored in CoverBackground if a label is truncated with fading

Thomas Perl th.perl at gmail.com
Thu Feb 6 08:58:18 UTC 2014


Hi,

On 05 Feb 2014, at 23:50, Tigre-Bleu <devel at tigre-bleu.net> wrote:
> If in a cover, a label is truncated with truncationMode: TruncationMode.Fade then the opacity value is ignored.
> 
> For code example and screenshot, see the following bug report: https://github.com/Buschtrommel/ocNews/issues/27#issuecomment-34267086
> 
> I think it is an issue with Silica component. I would expect opacity to be taken into account and the fading to opacity=0 still applied at the truncation location.

Yes, that might be a bug in Silica and a side-effect of how TruncationMode.Fade is implemented.

As a workaround, I made the color itself contain the opacity as alpha value in one of my apps:

    Label {
        text: ‘Some very long text….’
        truncationMode: TruncationMode.Fade
        color: Theme.rgba(Theme.highlightColor, 0.5 /* = opacity */)
    }

Of course, the first parameter to Theme.rgba() can be any color that you want, you are not limited to the color constants from the Theme.

HTH :)
Thomas


More information about the Devel mailing list