Snippet: fix Screen Orientation in a Qt/S60 app

  • snippet • orientation • screen • nokia • howto • it • symbian • english • s60 • qt
  • 103 words

I follow the Qt/S60 Mailing list, that is turning out to be a very interesting and active ML, and the Qt Labs blog, always full of very good code, written directly by the guys of Qt Software. I thought could be nice to start to post some of the stuff I’m learning.

#include <eikenv .h>
#include <eikappui .h>
#include <aknenv .h>
#include <aknappui .h>
// ...
// lock orientation
CAknAppUi* appUi = static_cast<caknappui *>( CEikonEnv::Static()->AppUi() );
if ( appUi ) //< Actually, this will always pass. It's a "static_cast" after all...
{
   appUi->SetOrientationL( CAknAppUi::EAppUiOrientationPortrait );
}
// ...

Today’s source is: Nokia Forum.</caknappui></aknappui></aknenv></eikappui></eikenv>