Hi Srikanth,

On Mon, Apr 25, 2011 at 9:34 PM, Srikanth <[email protected]> wrote:
> Hi,
>
> I have a simple qml item like
>
> Rectangle {
>
>      id: myRect
>
>      width: 360; height: 80
>
>      color: "white" // this color should be skinned dynamically using qss
>
>      //...
>
> }
>
> My requirement is that for different clients the color of the rect changes.
> This can be perfectly done using qss in a QWidget based approach, where we
> generate a qss specific to the client's requirement. Is there a way in which
> I can use qss or css to do styling in QML. I hope there should be one, but I
> need the best practice to achieve this.
>

If your skin is simply about switching colors and images, you can
expose a "Skin" QObject using QDeclarativeEngine::setContextProperty.
The Skin class can contain various properties that QML can bind to.
See QDeclarativePropertyMap that might help you create this "Skin"
Object.

(eg) Rectangle { id: myRect; color: skin.myRectColor } // skin is C++
object with property myRectColor

For more complex skins, you can just create a separate qml for each client.

Girish
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to