×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    26

    Force display orientation to Portrait

    I am beginner at mobile applications programming.
    My app has to be run in portrait mode, and I don't know how to ignore sensor reading, and autorotate...

    I've found this:
    http://wiki.forum.nokia.com/index.ph...Qt_for_Symbian

    but it's not working... I've got Qt 4.6 with Symbian SDK (~900MB download from http://www.forum.nokia.com/info/sw.n...ia_Qt_SDK.html)
    did i missed something?

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Force display orientation to Portrait

    The code in that first link is what you need (though obviously you should specify Portrait rather than Landscape).

    You say "it's not working" -- do you mean it won't compile, or it fails somehow when executed?

    Quote Originally Posted by blackbird700 View Post
    I am beginner at mobile applications programming.
    My app has to be run in portrait mode, and I don't know how to ignore sensor reading, and autorotate...

    I've found this:
    http://wiki.forum.nokia.com/index.ph...Qt_for_Symbian

    but it's not working... I've got Qt 4.6 with Symbian SDK (~900MB download from http://www.forum.nokia.com/info/sw.n...ia_Qt_SDK.html)
    did i missed something?

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    26

    Re: Force display orientation to Portrait

    when I say it's not working, I mean it compiles, but when executed, it doesn't force orientation (i tried both simulator and nokia5800). I replaced Landscape with Portrait. When I paste code from link, it is underlined yellow in QtCreator...

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Force display orientation to Portrait

    You did put the code where it would be executed, right? Before the first show of the main screen?

    Have you verified that the test for null isn't no-oping the operation? (I prefer using a Q_ASSERT, since the value should never be null.)

  5. #5
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Force display orientation to Portrait

    Also, the link is wrong in using dynamic_cast -- that form of cast is unreliable at best in Qt (and Symbian generally). In extreme cases it can actually cause physical damage to the phone.

    Use "reinterpret_cast" instead.

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    26

    Re: Force display orientation to Portrait

    ok, I downloaded and installed S60 SDK, and now it works on phone (it doesn't work on simulator, but i don't care for simulator)
    Thanks to danhicksbyron!

    I used reinterpret_cast..

  7. #7
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Force display orientation to Portrait

    I was wondering if there is now a simpler way of disabling auto rotation? Would it be possible by using something like QOrientationSensor?

  8. #8
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Force display orientation to Portrait

    Nope. All that does is let you read the accelerometer.

  9. #9
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Force display orientation to Portrait

    So is there another way then?

  10. #10
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Force display orientation to Portrait

    Use the Symbian code. It's the only way I know of.

Similar Threads

  1. Force portrait screen in CWsScreenDevice from executable (service)
    By lukedau in forum Symbian User Interface
    Replies: 4
    Last Post: 2010-09-17, 22:47
  2. portrait orientation and landscape orientation in N96
    By videoFx in forum [Archived] Flash Lite on Nokia Devices
    Replies: 0
    Last Post: 2009-05-20, 15:13
  3. Landscape/Portrait orientation
    By greumatt in forum Symbian User Interface
    Replies: 6
    Last Post: 2009-01-07, 09:46
  4. VideoControl Portrait orientation on Nokia 6300
    By piotridzikowski in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2008-05-27, 17:27
  5. How to force application always to stay in portrait mode?
    By wojciech.debowski in forum Symbian
    Replies: 4
    Last Post: 2008-05-16, 08:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×