February 9, 2012

hoanghua hoanghua
Lab Rat
20 posts

Disable rotating animation when orientation change

 

Hi,

May I ask if there is anyway disable rotating animation when screen orientation changed? In my application, I’m using PageStack to push a landscape page from a current portrait page. The animation make it look not really nice.

Regards,

Hoang HUA

6 replies

February 9, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

In a slot that handles the orientation change, use animation.stop() or animation.complete().

 Signature 

(Z(:^

February 9, 2012

hoanghua hoanghua
Lab Rat
20 posts

on PageStackWindow, i tried to use

  1. onOrientationChangeAboutToStart: {
  2.         animation.complete();
  3. }

however, it says “ReferenceError: Can’t find variable: animation”. should I need to change something to make it works. Thanks

February 9, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

I used “animation” as the id of QML Animation object. You should use the id from your app. So, if you are using “myAnimation” as id, you should write:

  1. onOrientationChangeAboutToStart: {
  2.     myAnimation.complete();
  3. }

 Signature 

(Z(:^

February 9, 2012

hoanghua hoanghua
Lab Rat
20 posts

Hi,

Maybe I’m wrong, but when you change the orientation with

  1. orientationLock = PageOrientation.LockLandscape;

the screen will be automatically rotated, so this animation is not created or handled by us; so is it possible for us to get this animation object so that we can stop it?

Thanks

February 9, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

Oh, sorry. I thought you are talking about an animation you have created yourself.

In this case, I don’t know what the solution is, probably, something OS-dependent has to be tweaked. I’m creating an app, it supports orientation changes, but no animation is played by default (that’s on Android. And to be honest, I’ve just realised I’ve turned animations off in OS settings… ;) ).

 Signature 

(Z(:^

February 10, 2012

hoanghua hoanghua
Lab Rat
20 posts

sierdzio wrote:
Oh, sorry. I thought you are talking about an animation you have created yourself.

In this case, I don’t know what the solution is, probably, something OS-dependent has to be tweaked. I’m creating an app, it supports orientation changes, but no animation is played by default (that’s on Android. And to be honest, I’ve just realised I’ve turned animations off in OS settings… ;) ).

@sierdzio: LOL

I’ve also not yet able to do this; however, a workaround can be done here which is to hide (visible) the PageStackWindow when orientation’s animation take place. Not a perfect way but it works :-)

 
  ‹‹ How to pass variables as reference from C++ to QML      QML Camera in portrait mode ››

You must log in to post a reply. Not a member yet? Register here!