[SailfishDevel] best way to work with covers?
Gabriel Böhme
m.gabrielboehme at googlemail.com
Fri Nov 29 23:51:58 UTC 2013
Hmm, Jolla uses Source Sans Pro as far as I know. Maybe it helps if you are
setting manually the font in your cover.
But it's interessting, maybe a bug?
Gabriel.
--
Von meinem Nokia N9 gesendet
Tigre-Bleu schrieb am 30.11.13 00:41:
Well, using the second case with no typo works but with this strange font
thing.
See attached picture:
- The top cover is while using cover: Qt.resolvedUrl("cover/CoverPage.qml")
- The bottom one is while using cover: CoverPage {id: myCoverPage}
Both are using correctly Theme.padding and Theme.xxxColor. However the font
is not the same...
Cheers,
Antoine
------------------------------
*De: *"Gabriel Böhme" <m.gabrielboehme at googlemail.com>
*À: *"Sailfish OS Developers" <devel at lists.sailfishos.org>, "Tigre-Bleu" <
devel at tigre-bleu.net>
*Envoyé: *Samedi 30 Novembre 2013 00:19:06
*Objet: *Re: [SailfishDevel] best way to work with covers?
Hello,
In first case your Cover is not an instance, instead it's created directly
from File, that means the function is not known.
The second case should work, if you change onUpdated to
onUpdated(myCoverPage.myFunction()) Because at the moment you don't use the
id's name!
Cheers Gabriel.
--
Von meinem Nokia N9 gesendet
Tigre-Bleu schrieb am 30.11.13 00:09:
Hi,
While that solution below works perfectly fine to get data from the
appWindow to the cover, I am facing an issue trying to do the opposite.
Let's explain. My AppWindow looks like this:
ApplicationWindow
{
MyModel {
...
onUpdated(cover.myFunction())
}
cover: Qt.resolvedUrl("cover/CoverPage.qml")
...
}
in CoverPage.qml I have the following:
CoverBackground {
...
myFunction(){
...
}
}
I am unable to execute myFunction for whatever reason I don't understand. I
also tried a few things like:
import "cover'
MyModel {
...
onUpdated(coverPage.myFunction())
}
cover: CoverPage {id: myCoverPage}
Weird that in that case the font used by the cover is not the regular
Sailfish font...
It is the same to access properties from the cover. How is it supposed to
work?
Thanks,
Antoine
------------------------------
De: "Andrey Kozhevnikov" <coderusinbox at gmail.com>
À: devel at lists.sailfishos.org
Envoyé: Samedi 16 Novembre 2013 08:48:05
Objet: Re: [SailfishDevel] best way to work with covers?
If you declare all your pages in ApplicationWindow like:
ApplicationWindow {
id: appWindow
cover: Qt.resolvedUrl("CoverPage.qml")
MainPage {
id: mainPage
}
SecondPage {
id: secondPage
}
}
then you can use pages global properties and functions from CoverPage:
CoverBackground {
id: cover
...
Label {
anchors.centerIn: cover
...
text: mainPage.processStatus
color: secondPage.getCoverColor()
}
}
On 16.11.2013 13:39, Gabriel Boehme wrote:
Hi Artem,
thanks for the fast response.
Your solution is a good idea, and could work for some values (main page
and first cover) - thanks for that! :), but not all.
Because I can pass them only in the moment I instantiate them. So I have
to instantiate all of them in the ApplicationWindow. This is possible,
but I guess due to the SailfishOS glass effect they appear stacked. So I
see other files (pages/cover), even if they are not set as the PageStack
first page or Cover. Maybe it's possible to workaround with opacity and
checking for PageStatus, but seems not to be the cleanest solution. And
the other side is, the console output/examples said, it's better to
create them just in the moment you really need them.
So I also tried, var page = Qt.createComponent("qml/file"), so I can
store a page/cover in a variable and push that on the PageStack, but I
can't reach the property aliases.
Thanks.
Gabriel.
Am Samstag, den 16.11.2013, 01:55 +0200 schrieb Artem Marchenko:
Hi Gabriel
There are several ways of passing data between Cover and rest of app
(or any components). You can try using app global object ids or
javascript files with .pragma library and gloval [to them] variables
or inject global objects from C++ via setContextProperty().
The way I like doing it is to keep shared object in main.qml and pass
it to pages/covers at the moment of instantiation the following way:
========
ApplicationWindow
{
id: app
property string sharedValue: "whatever you want to share to cover"
initialPage: Component {
MainPage {
torch: app.sharedValue
}
}
cover: Component {
CoverPage {
torch: app.sharedValue
}
}
}
========
I hope if helps.
Cheers,
Artem.
On Sat, Nov 16, 2013 at 1:00 AM, Gabriel Boehme
<m.gabrielboehme at googlemail.com> wrote:
Hi Sailfish sailors,
I want to ask, what is recommended/best practice to handle
different
covers/covers with dynamic information.
My case:
On the main page (MainPage.qml) you can select some options
and search
depending on the selected options. My main cover shows the
selected
options if minimized, so I can't just create it with
Qt.resolvedUrl("path/to/maincover.qml"), because I'm "talking"
to the
cover with via property aliases. So I'm creating this cover
directly as
an instance in ApplicationWindow.
After the search a ListView shows the results from a model and
I created
another cover to switch between the results with CoverAction
(show
next/previous) - it takes the data from the model. But also
shows some
information from main page - via property alias.
So the point is: to fill the cover pages with the dynamic data
I can't
create them with Qt.resolvedUrl("path/to/cover.qml"), or
push("mypage.qml") because I need property aliases to set the
information on the covers. But in the most examples and also
the console
output tells me, that it is not clever to create instances in
the
ApplicationWindow part.
So what is best practice? Do I miss something?
Thank you very much in advance.
Gabriel
_______________________________________________
SailfishOS.org Devel mailing list
--
Artem Marchenko
http://agilesoftwaredevelopment.com
http://twitter.com/AgileArtem
_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
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/20131129/35ca7797/attachment.html>
More information about the Devel
mailing list