[Interest] Export color schema via a QML import

kim kulling kim.kulling at googlemail.com
Fri Feb 21 17:00:54 CET 2014


Hi ML,

I have the following situation:
I have my own plugin based on QML with specific c++-types and my own
qml-types defined in separate qml-files. This works fine.

Now I also want to support 2 different color schemas in this plugin like:

Myplugin/
+-Styles+-Style1/Colors.qml
...............Style1/Styles.qml
...............Style1/qmldir
...............Style2/Colors.qml
...............Style2/Styles.qml
...............Style2/qmldir

In the file Style I only export the color schema as a property:

Style.qml:
import QtQuick 2.0


Item {

    id: styles

    property alias colors: colors


    Colors {

        id: colors

    }

}


the qmldir for style1 looks like:


module Myplugin.Styles.Style1
typeinfo plugins.qmltypes
Styles 1.0 Styles.qml


Same for Style2 with changed numers for the styles.


Now I am trying to assecc the colors via:


import Myplugin.Styles.Style1 as Style1


Rectangle {

    color: Style1.styles.colors

}


And I am getting the following error message:


Unable to assign [undefined] to QColor


I am not sure if this is the right way to go or what I'm currently
doing wrong. Any ideas?


With best regards,

Kim Kulling
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140221/db34059e/attachment.html>


More information about the Interest mailing list