[Qt-qml] Load css files

Pelle Johnsen pelle.johnsen at gmail.com
Wed Jun 15 12:16:20 CEST 2011


>From my experience CSS and QML doesn't mix very well.

Ended up coding a css-like styling system in JavaScript instead.

I hope future versions of QML will introduce better ways to deal with
styling and theming.

Also see: http://developer.qt.nokia.com/wiki/QmlStyling

 -Pelle

2011/6/15 Manuel Martín Ortega <manuel.martin at mirada.tv>

>  Hello,
>
> I am trying set text color from a css file in a QML.
>
> I can use css only if it is included in the Text.RichText, like this:
>
>     '<style type="text/css">
>         p
>         {
>         color:orange;
>         text-align:center;
>         }
>         </style>
>     <p>Hello</p>'
>
> The problem is I need the same configuration for different texts in
> different places so I try to load a css file but *it doesn't work*:
>
> '<head>
>         <link href="c.css" rel="stylesheet" type="text/css" />
>     </head>
>     <p>Hello</p>'
>
> OR
>
>     '<link href="c.css" rel="stylesheet" type="text/css" />
>     <p>Hello</p>'
>
> ¿Is there any way to load a css file?
>
> THX
>
> ********************************************************************
> This email and any attachments are confidential and meant only for the addressees,
> and may be protected by law. If this email has been sent to you in error,
> please notify the sender immediately and delete this e-mail from your computer.
> emails are not secure and we will not accept liability if this e-mail is accessed
> by anyone or modified or amended following dispatch.  Any views or opinions in this
> email are those of the author and do not represent those of Mirada unless otherwise
> specifically stated.  Although we have taken every reasonable precaution to ensure that
> any attachment to this e-mail has been checked for viruses, we do not accept
> liability for any damages.
>
> Mirada is a public limited company,
> Registered Number: 03609752
> Registered Office: Bentima House, 168-172 Old Street, London. EC1V 9BP
>
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110615/7a9e9659/attachment.html 


More information about the Qt-qml mailing list