can't access methods of data engine output for digital-clock declarative example

Aaron J. Seigo aseigo at kde.org
Fri Jun 3 10:17:06 CEST 2011


On Thursday, June 2, 2011 23:22:29 todd rme wrote:
> Hi,
> 
> I am working with the digital clock qml example in
> kdeexamples/plasma/declarative/digital-clock
> 
> One thing I am trying to do is extract and output the seconds from the
> dataengine.  The original example has this at line 54:
> 
>     Text { text: 'Time Is ' + dataSource.data['Local']['Time']; }
> 
> This displayed the time correctly.  I converted it to:
> 
>     Text { text: 'Time Is ' + dataSource.data['Local']['Time'].second(); }
> 
> This returned following error:
> 
>     main.qml:54: TypeError: Result of expression
> 'dataSource.data['Local']['Time'].second' [undefined] is not a
> function.

it would be getSeconds(), since it is supposed to be using the standard 
Javascript object for times ... however, it seems that QTime objects are not 
actually being translated into something useful :/

a small tweak to the dataengine should fix this by providing a complete 
DateTime object with both date and time, which QScript would then handle.

>     Text { text: 'Time Is ' +
> dataSource.data['Local']['Time'].split(":")[0]; }

Time.toString().split(":")[0]

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20110603/d2c04b97/attachment.sig 


More information about the Plasma-devel mailing list