UIConstants HowTo?
-
Looking at ways to have my Qt Quick app integrated to the MeeGo Harmattan look&feel; I found a slide mentioning the use of UIConstants: http://www.slideshare.net/tpyssysa/starting-development-for-nokia-n9 (slide 30)
However, the only thing I have been able to find is a (Symbian specific?) example at http://doc.qt.nokia.com/qt-components-symbian-1.0/demos-flickr-qml-uiconstants-js.html - and honestly is not telling me much.
In the meantime I'm trying to figure out things as simple as drawing manually a header that looks like the headers shown e.g. at http://www.developer.nokia.com/swipe/ux/pages/Colour.html to have this integrated look & feel...
-
UIConstants can also be seen at https://qt.gitorious.org/qt-components/qt-components/blobs/master/examples/meego/QmlComponentGallery/qml/ListPage.qml and there is no call to a "UIConstants.js" file.
Is it maybe something inherited from "import com.nokia.meego 1.0"?
I know this is the forum of Qt upstream and this seems to be something Nokia specific. Still, if someone can point to the place to find the documentation it would be great.
-
I am also wondering about this. "UiConstants" is used in every QmlComponentsGallery .qml file, but when I am searching for that keyword in the QmlComponentsGallery project, there are no hits for declaring this variable. Nor seems there to be documentation about this.
If I use UiConstants in my own Harmattan Qt Components based application in the Page item, I get the following error: "ReferenceError: Can't find variable: UiConstants".
Sounds like this kind of information (default margins, fonts, available text sizes...) should come from the FW. Any help would be appreciated. Any ideas where this constant is coming from?
-
[quote author="qgil" date="1311882084"]
In the meantime I'm trying to figure out things as simple as drawing manually a header that looks like the headers shown e.g. at http://www.developer.nokia.com/swipe/ux/pages/Colour.html to have this integrated look & feel...[/quote]Did you get an answer to this by some other means? Reading the UX page, it almost sounds like this is automatically provided by the framework - or something. And that all apps should use this one way or another.
bq. A key visual attribute of all Nokia N9 applications is the highlight color. Each application owns a unique highlight color for personality and differentiation.
bq. When choosing your application's highlight color, consider aligning it with the primary color of your brand to promote your brand's presence and strengthen your application's identity.
I can't see that QmlComponentsGallery would use this, though.
-
UiConstants implemented in C++ plugin. You don't have to import them in a special way, just
import com.meego 1.0.UiConstants was introduced in 1.1, and won't work with default N9, you have to wait for 1.1 of qt-components to be released or you may compile it yourself.
UIConstants.js is internal file, I don't think you will be able to access it from your app.
-
[quote author="dubik" date="1312263467"]
UIConstants.js is internal file, I don't think you will be able to access it from your app.
[/quote]Thanks for clarifying all this! The way QmlComponentsGallery uses UiConstant seems like a useful thing for other apps too (getting system's default font size, margins and such) to achieve similar look and feel across all apps. Is there some other way for 3rd party apps to get this kind of information? I don't quite understand why this would be kept internal, to be honest.
-
[quote author="Kypeli" date="1312269496"]
I don't quite understand why this would be kept internal, to be honest.
[/quote]
You probably didn't understand what I wrote. There are 2 sets of ui constants.
- UIConstants.js - thats internal because of some qml limitations
- UiConstants - thats public, provided by plugin.
(they may look same but check second letter and there is no ".js" :) so those things are different)
Feel free to use UiConstants, it doesn't have many constants yet, but we will add more and figure out a way to document it.
-
[quote author="dubik" date="1312269794"]
You probably didn't understand what I wrote. There are 2 sets of ui constants.- UIConstants.js - thats internal because of some qml limitations
- UiConstants - thats public, provided by plugin.
(they may look same but check second letter and there is no ".js" :) so those things are different)
Feel free to use UiConstants, it doesn't have many constants yet, but we will add more and figure out a way to document it. [/quote]
Oh, right. Thanks for clarifying this!
I did try to use UiConstants in my Qt Components application, but I was not successful. Please refer to bug report https://bugreports.qt.nokia.com/browse/QTCOMPONENTS-934 . As you can see, there seems to be some issues finding the variable when running on the device. Any ideas what I am missing?
-
Just as an added comment; QmlComponentsGallery also does
@import com.nokia.extras 1.1@
so I tried also to add that import statement to my own app to see if UiConstants is being imported from there. But apparently not. I get this error:
bq. module "com.nokia.extras" version 1.1 is not installed
What I fail to understand is how QmlComponentsGallery can run on the device with that import statement, but I cannot use it in my own app and run on the device...
Confusing.
-
UiConstants not in 1.0. Default N9, contains 1.0. You either have to wait for 1.1 or to copy parts of plugin.cpp to your app.
com.nokia.extras contains extra widgets, like date pickers and so on.
I think the problem is so that you look at 1.1 sources but run it on 1.0.
-
Thanks. I think it's clear to me now. I hope the N950/N9 will soon get an update to Qt Components 1.1, since it seems it's all that is needed :) Added documentation wouldn't hurt either...
-
Thanks for the explanations dubik. Waiting for the documentation, then.
fwiw I'm already using the 4.8 experimental stuff and
@import QtQuick 1.1
import com.nokia.meego 1.0@since this is what the "official examples for MeeGo":https://qt.gitorious.org/qt-components/qt-components/blobs/master/examples/meego/QmlComponentGallery/qml/ChangeToolbarPage.qml show. Seems to work in the N9 (at least with latest internal release).
-
When will UiConstants (as in com.nokia.meego 1.1) be available thru a SDK update? Little bit annoying not to be able to layout in a way that fits seamlessly into the nice UI...