×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    72

    Problem to Lock Orientation

    Hi everyone,

    I know this is a such stupid question, but I still can't solve after tried my best.........
    following is what I have tried:

    in .pro
    Code:
    symbian: {
        TARGET.UID3 = 0xSOMEUID
        LIBS += -lcone \
                -leikcore \
                -lavkon \
    }
    in .cpp
    Code:
    #ifdef Q_OS_SYMBIAN
    #include <eikenv.h>
    #include <eikappui.h>
    #include <aknenv.h>
    #include <aknappui.h>
    #endif
    
        #ifdef Q_OS_SYMBIAN
        CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
        
        if (appUi) {
            // Lock application orientation into landscape
            appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
        }
        #endif
    ok, then error occur, something like "undefined reference to typeinfo to CAknAppUi"........

    finally, the orientation can't lock at all........it depresses me.....

    Anything I missed?

    Thanks for advance.

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

    Re: Problem to Lock Orientation

    You only need #include <AknAppUi.h>.

    You need library eiksrv. You don't need library eikcore.

    Here's what I use:
    Code:
    #include <AknAppUi.h>
    // Need libs avkon cone eiksrv
    ....
        // lock orientation
    #ifdef Q_OS_SYMBIAN
        CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
        if(appUi){
            QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
        }
    #endif
    The Q_TRAP_THROWING eliminates a warning message and assures that you'll get an error if something goes wrong in the SetOrientationL call.

  3. #3
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: Problem to Lock Orientation

    The .pro libs statement I use in one of my apops which does the locking is this:
    Code:
    LIBS += -lcone \
        	    -leikcore \
           		 -lefsrv \
           		 -lavkon \
           		 -lmediaclientaudio \
            	 -lmediaclientaudiostream \
            	 -lcentralrepository \
            	 -lhal \
            	 -lws32
    Some of them are redundant though!
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

  4. #4
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    72

    Re: Problem to Lock Orientation

    tried what you guys suggested.......
    errors are still here.......

    undefined reference to 'CAknAppUiBase::SetOrientationL(CAknAppUiBase::TAppUiOrientation)
    undefined reference to 'typeinfo for CCoeAppUi'
    undefined reference to 'typeinfo for CAknAppUi'
    undefined reference to 'CCoeEnv::Static()'
    [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\Test.exe] Error 1

    What's going on??Anyone can give me a hand?

    Thanks for advance!

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

    Re: Problem to Lock Orientation

    Code:
    symbian: {
        TARGET.UID3 = 0xSOMEUID
        LIBS += -lcone \
                -leikcore \
                -lavkon \
    }
    Remove the trailing "\" character. It's a continuation character and there's nothing to continue to.

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2010
    Posts
    6

    Re: Problem to Lock Orientation

    Rather old thread, but might help others hopefully

    When you make changes to the libraries etc., make sure you clean the project and to be on the safe side also manually delete the makefiles from the project directory. Otherwise, Qt Creator might not recognize all changes and link to the new libs. The code works fine like you posted it.

  7. #7
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: Problem to Lock Orientation

    Andreas, nice to see you here.

    Other than that, I am happy to see yet another problem solved!
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

  8. #8
    Registered User
    Join Date
    Jun 2009
    Location
    Austria
    Posts
    27

    Re: Problem to Lock Orientation

    Quote Originally Posted by ajakl View Post
    When you make changes to the libraries etc., make sure you clean the project and to be on the safe side also manually delete the makefiles from the project directory. Otherwise, Qt Creator might not recognize all changes and link to the new libs. The code works fine like you posted it.
    Thanks, that fixed it for me. Some related problem was with deploying the app to the device when I added the "UID3" value to the .pro file (I didn't set this value before adding the code from this thread). In case this happens, simply remove the application from your device, remove the "UID3" statement and re-build the app, then re-deploy and it should work again.

    On an unrelated note:

    • Shouldn't there be a (cross-platform) Qt-ish wrapper/abstraction layer for screen orientation changes? Qt on Maemo already has this.
    • Why does Qt Creator not detect edits to .pro files and re-run qmake automatically? Bug or technical limitation?

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

    Re: Problem to Lock Orientation

    Yes, there should be a set of Qt functions for sensing/changing screen orientation. Should be in Mobility (strange that it wasn't included), but at the very least there should be a Symbian-unique set of functions.

    Carbide C++ does sense when the .pro is changed and re-runs qmake -- most of the time. Pretty unreliable, though, and doesn't handle the dozen other ways that configuration can change and invalidate the qmake config.

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

    Re: Problem to Lock Orientation

    Problem is solved for a long while, sorry for my delay report.
    All my previous is alright, just one more step needed!!
    right the project in Qt Creator and select "Run qmake"
    Done!!

Similar Threads

  1. Orientation problem
    By AndreAhmed in forum Symbian
    Replies: 9
    Last Post: 2010-04-14, 12:32
  2. Orientation problem
    By keerthi.ck06 in forum Symbian User Interface
    Replies: 3
    Last Post: 2009-10-08, 13:03
  3. 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
  4. Orientation Problem
    By memsmusik1 in forum Symbian
    Replies: 4
    Last Post: 2008-07-25, 17:18

Posting Permissions

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