[Qt-qml] Trivial issue I'm sure

mathias.malmqvist at nokia.com mathias.malmqvist at nokia.com
Tue Feb 8 13:55:39 CET 2011


Thanks Michael, but I resolved the issue. 
As someone else already suggested, rather than

property Margins margins
margins: { left: 10; right; 10; top: 6; bottom: 6 }

the correct syntax is

property Margins margins: Margins { left: 10; right; 10; top: 6; bottom: 6 }

Don't know why is still didn't seem to work with this syntax at first, but it 
does now. So the issue was indeed quite trivial.

Thanks!


Cheers
Mathias

________________________________________
From: Brasser Michael (Nokia-MS-Qt/Brisbane)
Sent: Tuesday, February 08, 2011 5:01 AM
To: Malmqvist Mathias (Nokia-MS/London)
Cc: qt-qml at qt.nokia.com
Subject: Re: [Qt-qml] Trivial issue I'm sure

Any chance you can share the C++ code for this? (that should make it much easier to identify the culprit)

Thanks,
Michael

On 04/02/2011, at 4:50 AM, ext mathias.malmqvist at nokia.com wrote:

>
> Hi,
>
> I've implemented an as-simple-as-you-can-imagine Margins QML type for the
> Qt Components implementation.
>
> Defining a Margin like this works fine:
>    property Margins margins
>
> But when I try to set the margin like this
>    margins: { left: 10; right: 10; top: 10; bottom: 10 }
> I get "Unable to assign double to QCpMargins*" errors
> (my class is called QCpMargins just not to clash with Qt's QMargins class)
>
> and when I try reading a value:
>    Component.onCompleted: print(margins.left)
> I get "TypeError: Result of expression 'margins' [null] is not an object." errors.
>
> If I misspell "Margin" in the property definition above I get an error, so the type is definitely found.
>
> Comparing my code with other similar code, everything looks in order, so I'm stumped.
> The only difference I can see is that my type does not Q_DECLARE_PRIVATE a
> implementation class, but I don't think that should matter, right?
>
> Any idea what would cause this problem. I'm sure it's something simple...
>
> Thanks!
>
>
> Cheers
> Mathias
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml



More information about the Qt-qml mailing list