×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    93

    How to lock rotation with Nokia Qt Sdk

    Hi,
    i would like to lock the rotation of the device in portrait mode, how can i implement that?

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

    Re: How to lock rotation with Nokia Qt Sdk

    Code:
    #include <AknAppUi.h>  // add libs avkon, cone, and eiksrv to your PRO file.
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        
        // lock orientation
        CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
        if(appUi){
            QT_TRAP_THROWING(appUi ->SetOrientationL( CAknAppUi::EAppUiOrientationLandscape));
        }
        
        ScreenDemo w(&a);
    
        // force full-screen mode (use showMaximized otherwise)
        w.showFullScreen();
        return a.exec();
    }

  3. #3
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    93

    Re: How to lock rotation with Nokia Qt Sdk

    Tnx so much, Isn't there a way to do that without using specific Symbian Library and mantain mobile cross-platform with Maemo, and the future Meego?

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

    Re: How to lock rotation with Nokia Qt Sdk

    #ifdef is about your only option. Stupid that this function wasn't included in the Mobility stuff, but it's apparently not "sexy" enough to make the cut.

  5. #5
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    93

    Re: How to lock rotation with Nokia Qt Sdk

    i agree with u, so stupid that it's not included in the mobility package... tnx for ur support

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    94

    Re: How to lock rotation with Nokia Qt Sdk

    hi, can you please tell me how to add avkon, cone, and eiksrv to my PRO file, sry but I am new in QT and I need to lock the rotation

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    22

    Re: How to lock rotation with Nokia Qt Sdk

    Add this to your .pro file:

    Code:
    symbian {
        LIBS += -lcone \
            -leikcore \
            -lavkon
    }

  8. #8
    Registered User
    Join Date
    Oct 2010
    Posts
    94

    Re: How to lock rotation with Nokia Qt Sdk

    Quote Originally Posted by Harmiih View Post
    Add this to your .pro file:

    Code:
    symbian {
        LIBS += -lcone \
            -leikcore \
            -lavkon
    }

    I did that but the code gives me 6 undefined reference errors!!!! about:
    appUi ->SetOrientationL( CAknAppUi::EAppUiOrientationLandscape)

  9. #9
    Registered User
    Join Date
    May 2010
    Posts
    22

    Re: How to lock rotation with Nokia Qt Sdk

    In your main.cpp you need to check that platform you are building is symbian, like this.

    Code:
    #ifdef Q_OS_SYMBIAN
        CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
        if(appUi){
            QT_TRAP_THROWING(appUi ->SetOrientationL( CAknAppUi::EAppUiOrientationLandscape));
        }
    #endif
    Also I had to do release build instead of debug build in order to get it to work.

  10. #10
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    93

    Re: How to lock rotation with Nokia Qt Sdk

    when u open a new project and select Mobile Qt Application, you select the devices u want to use, Maemo, Symbian, and in your myproject.pro file something like

    symbian: {
    # somethinghere
    }

    between the graphs simply add

    LIBS += -lcone \
    -leikcore \
    -lavkon

    then in the .cpp u want to use the rotation lock, i suggest u to do that in main.cpp add at the beginning

    #ifdef Q_WS_S60
    #include <eikenv.h>
    #include <eikappui.h>
    #include <aknenv.h>
    #include <aknappui.h>
    #endif

    and in the source code:

    #ifdef Q_WS_S60
    CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
    if(appUi){
    QT_TRAP_THROWING(appUi ->SetOrientationL( CAknAppUi::EAppUiOrientationLandscape));
    }
    #endif

  11. #11
    Registered User
    Join Date
    Oct 2010
    Posts
    94

    Re: How to lock rotation with Nokia Qt Sdk

    Thank you so much now its working but if I want it portrait not landscape what should I replace CAknAppUi::EAppUiOrientationLandscape ?? can you tell me please?

  12. #12
    Registered User
    Join Date
    May 2010
    Posts
    22

    Re: How to lock rotation with Nokia Qt Sdk

    CAknAppUi::EAppUiOrientationLandscape is for Orientation Landscape, it's not that hard to figure out what is for Orientation Portrait

  13. #13
    Registered User
    Join Date
    Oct 2010
    Posts
    94

    Re: How to lock rotation with Nokia Qt Sdk

    hhhh yes I tried it it is CAknAppUi::EAppUiOrientationPortrait :P

    I shouldn't ask before trying ...

    Thanks anyway..^^

  14. #14
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    93

    Re: How to lock rotation with Nokia Qt Sdk

    Landscape -> CAknAppUi::EAppUiOrientationLandscape
    Portrait -> CAknAppUi::EAppUiOrientationPortrait

  15. #15
    Registered User
    Join Date
    Oct 2010
    Posts
    94

    Re: How to lock rotation with Nokia Qt Sdk

    Thank u all now its clear and working well...

Similar Threads

  1. Getting build issues while installing QT-ORBIT for NOKIA-QT-SDK.
    By srinivas.kilari in forum [Closed] Publishing to Nokia Store
    Replies: 0
    Last Post: 2010-09-03, 10:29
  2. Replies: 3
    Last Post: 2010-06-30, 01:17
  3. QT Blutooth module not available in Nokia QT SDK (QT 4.6.3)
    By Suyash in forum [Archived] Qt SDKs and Tools
    Replies: 5
    Last Post: 2010-06-25, 09:55
  4. Qt SDK/Version path problems with Nokia Qt SDK beta on Windows 7
    By Evolius in forum [Archived] Qt SDKs and Tools
    Replies: 3
    Last Post: 2010-05-10, 19:46

Posting Permissions

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