[Interest] Using QtQuick 2.0 Screen.orientation
Jim Hodapp
jim.hodapp at canonical.com
Tue Mar 5 19:36:35 CET 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Rutledge,
On 03/05/2013 09:02 AM, Rutledge Shawn wrote:
> On 25 Feb 2013, at 11:11 PM, Jim Hodapp wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> I'm attempting to be notified in my QML application of when the
>> underlying QScreen instance (one that I've implemented for my
>> platform as a QPA plugin) changes the orientation property. In my
>> QPA plugin, I am calling
>> QWindowSystemInterface::handleScreenOrientationChange() any time
>> after I set the orientation, and have also implemented the
>> orientation() function. I call it like so:
>>
>> QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(),
>>
>>
currentOrientation_);
>>
>> On my QML side, I simply have a Rectangle, and inside that
>> rectangle I have the following signal handler:
>>
>> Screen.onOrientationChanged: { console.log("*** Screen
>> Orientation: " + orientationEnumToText(orient)); }
>>
>> The only time I see this is immediately after my QML app is run
>> using qmlscene. The orientation value is the default value,
>> namely Qt.PrimaryOrientation. I'm confused why I'm not getting
>> any other signal calls from my QPA implementation in my QML app?
>> I've also set the orientationUpdateMask in my QPA plugin by
>> calling setOrientationUpdateMask() and passed it all 4 major
>> orientations.
>>
>> What else do I need to do to get my signal handler in my QML app
>> to be called every time the orientation changes in the QPA
>> plugin?
>
> Sorry for the silence; it's a little early to answer this very
> specifically, because we are just now implementing it on a couple
> of platforms, and there are differences between them.
>
> So you are writing a new QPA plugin? Is this for Mir?
So I figured out the solution, and it was that I need to set the
update mask within my application. This works in my case since it was
a C++/QML app, but if you're writing a pure QML app, currently you
can't set the update mask and Screen.onOrientationChanged will not get
signaled.
This is for the Ubuntu Touch platform.
Thanks,
Jim
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJRNjszAAoJENCYE0OpVkFTuXoH/j0L1Sm03QMg4rLQDH3KHJsr
o/M5vCrP8G2MRtKKczFjoVjdrQErVNULEaQ2jJ9ext7ViC2fOXW6UsLdn4qMKhJT
DEbvyBELWO6qk1lScQe/mXZ55CLaoWiAPHQiqCqVXH/8CNVd1uy3xZ6J0uWxQ3kl
mgBwg4MoEGOpINKrm2Spt2ZX+XRtB6En1KP3oiAbf4DJivnKIUPn1vAVAqk5/Ffo
pI2lk4c0BiurMYz0/yeZHHf6Og63jXuTmquplucngjnCo5nC/4p1uRAkZ0qZuC50
tZP6qDxgdFNyHkJ5HJ+B6ykUEL3yR4AG9b848h9W7MfzVxKtDCSgVoaXnjienYc=
=vc3h
-----END PGP SIGNATURE-----
More information about the Interest
mailing list