[SailfishDevel] Accessing Saifish theme from javascript

Kimmo Lindholm Kimmo.Lindholm at eke.fi
Sat Jan 4 11:47:01 UTC 2014


Gives following from .import line:
[W] unknown:23 - qrc:///js/constants.js:23: SyntaxError: Unexpected token .

If I add 1.0, I get warning
[W] unknown:23 - qrc:///js/constants.js:23:1: Module import requires a qualifier


(Docs say .import TypeNamespace MajorVersion.MinorVersion as Qualifier)



So back where started...

>.import Sailfish.Silica.theme
>
>var color_info = Theme.primaryColor
On 04.01.2014 17:14, Kimmo Lindholm wrote:
Tested, didn't work - same results

.import Sailfish.Silica.Theme 1.0 as SilicaTheme
var color_info = SilicaTheme.primaryColor;



>import Sailfish.Silica.theme 1.0
On 04.01.2014 16:49, Kimmo Lindholm wrote:
I assume this is clear as daylight but I don't get it...

I need to access Theme colors from javascript -file;

I have successfully imported it

.import Sailfish.Silica 1.0 as Silica

and in QtCreator after typing Silica. I can see dropdown of all sort of stuff, but no 'Theme'.
And tinkering didn't work:

var color_info = Silica.Theme.primaryColor;

It gives runtime warning from QML side where color_info is used:
[W] unknown:104 - qrc:///qml/MainPage.qml:104: Unable to assign [undefined] to QColor

And those which are colored from js side with color_info do appear black...


-kimmo








_______________________________________________

SailfishOS.org Devel mailing list





_______________________________________________

SailfishOS.org Devel mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140104/07f17d9f/attachment.html>


More information about the Devel mailing list