Re: [Qt-qml] Error with PropertyAction/SequentialAnimation/Timer

2010-12-08 Thread Mark Tucker
Thanks,

That works!

The behaviour does seem slightly strange though - I would expect the JS 
function to complete and THEN have everything else updated, but as long as I 
know that this is the current behaviour I can create code accordingly.

Thanks again

Mark

-Original Message-
From: Adriano Rezende [mailto:adriano.reze...@openbossa.org] 
Sent: 07 December 2010 19:16
To: Mark Tucker
Cc: qt-qml@trolltech.com
Subject: Re: [Qt-qml] Error with PropertyAction/SequentialAnimation/Timer

On Tue, Dec 7, 2010 at 12:59 PM, Mark Tucker mark.tuc...@airborne.aero wrote:
        Timer {
                id: textTimer
                interval: 5000
                repeat: true
                running: true
                triggeredOnStart: true
                onTriggered: {
                        listIndex++;
                        if (listIndex = model.count) {
                                listIndex = 0;
                        }
                        //console.log(listIndex:  + listIndex + 
 count:  + model.count)
                        textAnimation.start();
                }
        }
 }
 For some reason the PropertyAction is being called when listIndex is 3
 and hence causes an error due to an undefined value. I'm failing to see
 how it should ever be the case that listIndex should be 3 when the
 PropertyAction does its thing though.

I believe QML will reevaluate a JS statement each time you change a
bindable property contained in that statement. So, even if the
animation is not running, model.get(listIndex).dataString will be
reevaluated when listIndex changes.
So, in order to solve this problem you can change the code below:

 listIndex++;
 if (listIndex = model.count) {
 listIndex = 0;
 }

for the following:

listIndex = (listIndex + 1) % model.count;

Br,
Adriano

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] QML Action element

2010-12-08 Thread Thomas Perl
2010/12/8  warwick.alli...@nokia.com:
 I hope declarative doesn't end up meaning screw abstraction, we'll
 make everything as painfully concrete as possible ;-).

 Actions are a nice way to declare a bunch of things that the user can
 do, which can later be moved around by the view developer to different
 presentation (toolbar / app menu / context menu / shortcut / tv remote
 control / whatever). Compared to just exposing a method, Action can
 have icon, (translated) text, status tip, etc...

 And yet they bind the notions of UIs are a bunch of commands and commands 
 have static icons and test labels into the design language of the user 
 experience, while abstracting something that is trivial.

 Anyone trying to write applications by devising a traditional 
 toolbar-menu-buttons UI and then expecting some magic style to be applied 
 to their abstraction in order to make a pleasant UI is riding on the wrong 
 bus.

 Start with the interaction design and the abstract logic engine, then bring 
 the two together. Do not just add UI abstractions on the engine and expect 
 success - that only works for SAP and Lotus Notes, and well, it doesn't 
 actually work at all, does it?

Mini-{rant,remark}: If you argue about abstraction, one could say that
MouseArea does not have to have the clicked signal, as pressed and
released already provide everything one needs, and clicking is
something that comes from a traditional mouse-centered UI, and already
encourages designers to think in terms of clicks. (Why isn't it
called TouchArea or InteractiveArea? Where are the gestures? onPinch?)

Thomas

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


[Qt-qml] Loading font from resource file not working on Symbian

2010-12-08 Thread Cornelius Hald
Hi,

in my QML UI I'm loading a font out of a resource file. On Linux and
Windows it seems to work, but on Symbian (and I think Maemo) I get the
following error:

qrc:qml/MainWindow.qml:16:5: QML FontLoader: Cannot load font:
qrc:qml/fonts/Ubuntu-R.ttf

This is with Qt 4.7.1. Is this a known bug or am I missing something?

Thanks!
Conny



___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Loading font from resource file not working on Symbian

2010-12-08 Thread Juha Turunen
Hi,

I think the Symbian Qt port is just lacking functionality in this
department (don't know about Maemo).

You can work around this though with some Symbian specific code.
Non-damaged souls and uninterested parties, please close your eyes for
the rest of this e-mail.

You need to tell the Symbian FBS (font and bitmap server) that it
should add your font to the typeface store. You can do that with this
bit of code:

TInt id;
CEikonEnv::Static()-ScreenDevice()-AddFile(_L(path to your
font file), id);

You don't have to explicitly add the font file, if you deploy to
\resource\fonts\ (you still need to refresh the store or reboot after
installation though), but I would advise against that, because it
complicates uninstalling and updating (the font file will be locked
after boot and you'll need to provide a small exe in your .sis file to
unload the font).

You can clean up after yourself using RemoveFile() if your app is
somewhat rarely used and you want to free up the resources.

After adding the font file to the typeface store you can use the font
in your QML elements just by referring to it in font.family property.

Juha

On Wed, Dec 8, 2010 at 12:39 PM, Cornelius Hald h...@icandy.de wrote:
 Hi,

 in my QML UI I'm loading a font out of a resource file. On Linux and
 Windows it seems to work, but on Symbian (and I think Maemo) I get the
 following error:

 qrc:qml/MainWindow.qml:16:5: QML FontLoader: Cannot load font:
 qrc:qml/fonts/Ubuntu-R.ttf

 This is with Qt 4.7.1. Is this a known bug or am I missing something?

 Thanks!
 Conny



 ___
 Qt-qml mailing list
 Qt-qml@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Loading font from resource file not working on Symbian

2010-12-08 Thread Cornelius Hald
Hi Juha,

On Wed, 2010-12-08 at 13:52 +0200, Juha Turunen wrote:
 I think the Symbian Qt port is just lacking functionality in this
 department (don't know about Maemo).

I just tried again on Maemo and the font is loaded correctly. So the
problem really only seems to be Symbian.

 You need to tell the Symbian FBS (font and bitmap server) that it
 should add your font to the typeface store. You can do that with this
 bit of code:
 
 TInt id;
 CEikonEnv::Static()-ScreenDevice()-AddFile(_L(path to your
 font file), id);

Looks a bit scary to a Symbian noob like me :) Also I then can't load
the font from the resource file anymore. Still, if this part is missing
in Qt, it seems to be a reasonable way.

 You don't have to explicitly add the font file, if you deploy to
 \resource\fonts\ (you still need to refresh the store or reboot after
 installation though), but I would advise against that, because it
 complicates uninstalling and updating (the font file will be locked
 after boot and you'll need to provide a small exe in your .sis file to
 unload the font).
 
 You can clean up after yourself using RemoveFile() if your app is
 somewhat rarely used and you want to free up the resources.
 
 After adding the font file to the typeface store you can use the font
 in your QML elements just by referring to it in font.family property.

Thanks a lot for all this information. I'll give it a try as soon as
possible. BTW, do you know if there is a bug report about this already?
If not I think I should file one.

Cheers,
Conny


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Loading font from resource file not working on Symbian

2010-12-08 Thread Juha Turunen
 You need to tell the Symbian FBS (font and bitmap server) that it
 should add your font to the typeface store. You can do that with this
 bit of code:

     TInt id;
     CEikonEnv::Static()-ScreenDevice()-AddFile(_L(path to your
 font file), id);

 Looks a bit scary to a Symbian noob like me :) Also I then can't load
 the font from the resource file anymore. Still, if this part is missing
 in Qt, it seems to be a reasonable way.

Don't be afraid the water is warm.. :) Just flag it with Q_OS_SYMBIAN
and #include eikenv.h and w32std.h

 Thanks a lot for all this information. I'll give it a try as soon as
 possible. BTW, do you know if there is a bug report about this already?
 If not I think I should file one.

I could dig a bit and try to find out where the problem is (I'm sure
it'll get fixed faster that way) and file a report. I remember trying
out the FontLoader on Symbian myself a while ago and it didn't work,
so the problem is probably something else than just embedding the font
into a Qt resource file (I can imagine getting that working might be
hairy).

Juha

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] How to know who is the parent !

2010-12-08 Thread Thomas Perl
Hi Thomas,

2010/12/8 Thomas PABST thomas.pa...@gmail.com:
 When we design new QML Element which can be call by a lot of other QML
 elements( Items, Buttons ...) we sometime need to know which call it.
 I am looking for a way to know how the current element was called. Which is
 the source, but only with qml or JavaScript, not c++.
 On my case, many elements call only one element. But the action will differ
 depending on who called it.

Do you mean can be a child or do you mean can be called? What is
an action in that case then? Can you give an example?

If it's about child elements, maybe you can solve the problem by
properties on the child element, so that the properties control how it
looks/what it does (this also makes it more modular, as the child does
not need to know the details about its surroundings, but rather only
needs to know its properties and what they mean).

If it's about some callback/function, the same thing applies - just
pass the action you want to do as parameter (e.g. an enum or a string
describing the action), so that the callee does not need to know who
called and from where - improves modularity, and should produce
cleaner code.

HTH.
Thomas
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Loading font from resource file not working on Symbian

2010-12-08 Thread Adriano Rezende
On Wed, Dec 8, 2010 at 11:56 AM, Cornelius Hald h...@icandy.de wrote:
 Thanks a lot for all this information. I'll give it a try as soon as
 possible. BTW, do you know if there is a bug report about this already?
 If not I think I should file one.

Hi,

I faced the same problem.
It seems that application fonts are not supported for Symbian yet:

http://bugreports.qt.nokia.com/browse/QTBUG-6611

Br,
Adriano
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


[Qt-qml] print the stack trace in QML?

2010-12-08 Thread Johnson Ma
Hi,

Is there any way in QML to access the stack trace information when error
happens?

Something like the error.stack or console.trace function in web browsers
will be useful to quickly identify the problem.

B.R.

Johnson Ma

Keep it simple, stupid
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml