Results 1 to 3 of 3

Thread: Lock screen orientation

  1. #1
    Join Date
    Feb 2008
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Lock screen orientation

    Hi all,
    is there a way to lock the screen to for all mobile devices to portrait mode only by code?
    I found a solution for doing that on android with overriding the standard activity and add code
    for a jni call. But I also need that on iOS.
    I also tried:
    Qt Code:
    1. QScreen* screen = QGuiApplication::primaryScreen();
    2. screen->setOrientationUpdateMask(Qt::PortraitOrientation);
    To copy to clipboard, switch view to plain text mode 

    but this seems to have no effect, screen is still rotating.
    Any ideas?
    Thx,
    Patrik

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,328
    Thanks
    36
    Thanked 1,527 Times in 1,478 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Lock screen orientation

    Orientation update mask is only for limiting the orientation change signals to the ones you are interested in.

    There might not be any Qt API right now to force a certain orientation, probably requiring native code.

    Might make an interesting upstream contribution

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    patrikd (1st November 2014)

  4. #3
    Join Date
    Feb 2008
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Lock screen orientation

    ok, is than there a way on iOS to access the basic ui-controller like under android?
    I found this for iOS:
    Qt Code:
    1. @implementation UINavigationController (Rotation_IOS6)
    2.  
    3. -(BOOL)shouldAutorotate
    4. {
    5. return UIInterfaceOrientationMaskPortrait;
    6. }
    7.  
    8. -(NSUInteger)supportedInterfaceOrientations
    9. {
    10. return UIInterfaceOrientationMaskPortrait;
    11. }
    12.  
    13. - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    14. {
    15. return UIInterfaceOrientationPortrait;
    16. }
    17.  
    18. @end}
    To copy to clipboard, switch view to plain text mode 
    but for this I think I have to implement the UINavigationController. Has anyone done this?
    best,
    patrik

Similar Threads

  1. Qt white font on Nokia N8, block screen orientation
    By Asus_G72GX in forum Qt Programming
    Replies: 2
    Last Post: 26th December 2012, 07:11
  2. QML page - Lock orientation of the phone
    By SeN in forum Qt Quick
    Replies: 1
    Last Post: 19th April 2011, 16:45
  3. Lock screen after inactivity time
    By baobui in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 20th March 2011, 22:18
  4. Screen orientation
    By Tomasz in forum Qt for Embedded and Mobile
    Replies: 6
    Last Post: 31st August 2010, 09:47
  5. Lock Screen
    By ahmdsd_ostora in forum Qt Programming
    Replies: 16
    Last Post: 11th July 2010, 09:55

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.