"ext qt-qml-requ...@trolltech.com" <qt-qml-requ...@trolltech.com> wrote:


Send Qt-qml mailing list submissions to
        qt-qml@trolltech.com

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.trolltech.com/mailman/listinfo/qt-qml
or, via email, send a message with subject or body 'help' to
        qt-qml-requ...@trolltech.com

You can reach the person managing the list at
        qt-qml-ow...@trolltech.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Qt-qml digest..."


Today's Topics:

   1. Re: Using enums in QML signal handlers (jerome.pas...@nokia.com)
   2. Win/Lin differences (Jason H)
   3. Re: JavaScript with .pragma library cannot see    Component
      object (Ville M. Vainio)


----------------------------------------------------------------------

Message: 1
Date: Fri, 19 Nov 2010 23:33:48 +0100
From: <jerome.pas...@nokia.com>
Subject: Re: [Qt-qml] Using enums in QML signal handlers
To: <michael.bras...@nokia.com>, <ext-salonen.o...@nokia.com>
Cc: qt-qml@trolltech.com
Message-ID:
        
<7e2e76540f3c0c49bdeb06f892c61f0054f44e4...@nok-eumsg-04.mgdnok.nokia.com>

Content-Type: text/plain; charset="Windows-1252"

Hello,

There is a similar bug that was already fixed: 
http://bugreports.qt.nokia.com/browse/QTBUG-11313

How do you register the enum in the Qt Declarative module?
Did you use qmlRegisterUncreatableType?
http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeengine.html#qmlRegisterUncreatableType

Thanks,
Jerome P.
________________________________________
From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of 
Brasser Michael (Nokia-MS-Qt/Brisbane)
Sent: Wednesday, November 03, 2010 6:26 AM
To: Olli Salonen (EXT-Futurice/Berlin)
Cc: qt-qml@trolltech.com
Subject: Re: [Qt-qml] Using enums in QML signal handlers

Hi Olli,

This sounds like a bug -- could you please create a report at 
bugreports.qt.nokia.com<http://bugreports.qt.nokia.com>?

Thanks,
Michael

On 02/11/2010, at 11:06 PM, ext 
ext-salonen.o...@nokia.com<mailto:ext-salonen.o...@nokia.com> wrote:

Hi,

I have declared an enum in a class and use it as an argument in a signal. I can 
use the enum in QML, but I cannot read the parameter in the signal handler. Is 
it supposed to work somehow?

Example:

class MyObject {
  Q_OBJECT
  Q_ENUMS(MyEnum)
  Q_PROPERTY(MyEnum value READ value NOTIFY valueChanged)
public:
  enum MyEnum { Value1, Value2};
signals:
  void valueChanged(MyEnum value);
}

Qml file
----------
MyObject {
  onValueChanged: console.debug(?Value is ? + value)
}

This fails with the following output:
QMetaProperty::read: Unable to handle unregistered datatype 'MyEnum' for 
property 'QDeclarativeBoundSignalParameters::value'

I also tried to rename the signal parameter type to MyObject::MyEnum, but this 
did not work either. I can use the value correctly if I access it as a 
property, or if I assign enum values such as ?property int myvalue: 
MyObject.Value1?.

Thanks,
Olli
<ATT00001..txt>




------------------------------

Message: 2
Date: Fri, 19 Nov 2010 18:46:21 -0800 (PST)
From: Jason H <scorp...@yahoo.com>
Subject: [Qt-qml] Win/Lin differences
To: qt-qml@trolltech.com
Message-ID: <323032.9180...@web120711.mail.ne1.yahoo.com>
Content-Type: text/plain; charset=us-ascii

I am developing/testing on WinXP, deploying on Lin (TCE/X11/Nvidia ION) 4.7.0 on
both. I had some surprises...

1. When I set opacity to 255 (errantly) in Win, it renders fine. On Lin, it
doesn't render at all until opacity = 1
2. Text font.pointSize doesn't seem to be respected on Linux, but pixelSize is
works.





------------------------------

Message: 3
Date: Sat, 20 Nov 2010 09:47:38 +0200
From: "Ville M. Vainio" <vivai...@gmail.com>
Subject: Re: [Qt-qml] JavaScript with .pragma library cannot see
        Component       object
To: ext-rene.1.han...@nokia.com,        "ext ext-ivailo.il...@nokia.com"
        <ext-ivailo.il...@nokia.com>
Cc: qt-qml@trolltech.com
Message-ID: <1290239258.1585.13.ca...@nokia-n900>
Content-Type: text/plain; charset="utf-8"

I think that documentation is misleading - you can easily maintain state in a 
singleton inside your .js file, using .pragma library.. You just need to ensure 
that you pass the needed qml side information in arguments instead of referring 
to them directly.

It's sort of like combining c++ and qml, really.

--
Sent from my Nokia N900

----- Original message -----
> This is because when you include .pragma, you are really indicating that
> you want to create a stateless library. Here's an excerpt from the Docs
> about integrating Javascript:
>
> > > >
> Stateless JavaScript libraries
> Some JavaScript files act more like libraries - they provide a set of
> stateless helper functions that take input and compute output, but never
> manipulate QML component instances directly.
>
> As it would be wasteful for each QML component instance to have a unique
> copy of these libraries, the JavaScript programmer can indicate a
> particular file is a stateless library through the use of a pragma, as
> shown in the following example.
>
> // factorial.js
>?  .pragma library
>
>?  function factorial(a) {
>? ? ? ? ?  a = parseInt(a);
>? ? ? ? ?  if (a <= 0)
>? ? ? ? ? ? ? ? ?  return 1;
>? ? ? ? ?  else
>? ? ? ? ? ? ? ? ?  return a * factorial(a - 1);
>?  }
>
> The pragma declaration must appear before any JavaScript code excluding
> comments.
>
> As they are shared, stateless library files cannot access QML component
> instance objects or properties directly, although QML values can be
> passed as function parameters.
> <<<
>
> Hope this helps.
>
> /Ren?
>
> On Fri, 2010-11-19 at 16:17 +0000, ext ext-ivailo.il...@nokia.com wrote:
> > Hi,
> >
> > I'm trying to create JS library with QML. As written in the
> > documentation I write in the beginning of the JS file .pragra library
> > everything is ok - now my library is not stuck to one QML file and I
> > can everything is ok
> >
> > the problem is that I cannot see Component.Ready and Component - it's
> > not null, but I have error directly when I want to access it :
> > ReferenceError: Can't find variable: Component.
> >
> > if I remove the .pragma library then everything is ok - I can see
> > Component and Comonent.Ready
> >
> > My question is:
> >
> > Is it done on purpose? Is there any reason why I cannot use / and see
> > / those objects in the library is "object". Just a quick tip - Qt
> > object is there - I can see it with or without marking my JS as
> > library.
> >
> > For now I can just "wrap" the error - as Component.Ready is 1 - I will
> > just replace it with 1, but it will be nice if I know what else I can
> > and cannot do with libraries and not.
> >
> > Best Regards,
> > Ivo
> > _______________________________________________
> > 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://lists.trolltech.com/pipermail/qt-qml/attachments/20101120/4a8bcb11/attachment-0001.html

------------------------------

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


End of Qt-qml Digest, Vol 9, Issue 53
*************************************

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

Reply via email to