[Development] Possible bug in signals and slots handling in QML.

Thiago Macieira thiago.macieira at intel.com
Wed Jan 4 15:32:34 CET 2012


On Wednesday, 4 de January de 2012 07.51.48, Atlant Schmidt wrote:
> Thiago, et al.:
> 
>   This is another one of those "don't play in the
>   grey areas of the language" things.
> 
>   Even if identifiers are case-sensitive, one should
>   probably never depend upon that; why tempt fate?

"You should not depend on case sensitiveness" reads to me as "You can depend 
on being case insensitive".

Does the following work?

Rectangle {
    property int foo: 0
    private signal bar

    onBar: FOO = 1
}

I recommend deprecating the capitalisation rule and introduce a non-mangling 
construct, such as:

    on property(foo):
    on signal(bar):

The "on" keyword is already reserved anyway (SequentialAnimation on foo).

For signals, it would also be a good idea to name the arguments there, instead 
of depending on magic variables appearing in your context. Think of

Rectangle {
    property string name
    signal nameChanged(string name)

    onNameChanged: { otherFunction(name); }
}

Which name was used there? Does the QML interpreter warn about shadowing, like 
the C++ compiler can be asked to do?

I'm not saying this can't be solved by writing better code in the beginning, 
but imagine that the signal and the property (which are public) already 
existed in a previous version...

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120104/67516036/attachment.sig>


More information about the Development mailing list