Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 4.7.3 screen rotation issue on Symbian^3 [Solved]
QtWS25 Last Chance

Qt 4.7.3 screen rotation issue on Symbian^3 [Solved]

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 4 Posters 10.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leon.anavi
    wrote on last edited by
    #1

    Hi,

    I have a problem with screen rotation after update Qt version on Nokia E7 to 4.7.3.

    I have decided to port a very simple Qt application available for MeeGo netbook to Symbian. Everything was OK until I updated Qt version to 4.7.3 using Nokia Smart Installer (Qt SDK 1.1) on Nokia E7. Now if I start the application everything is OK BUT if I rotate the device the screen is not displayed correctly anymore.

    The same source code build with Nokia Qt SDK 1.0 was OK before the update and it is working fine on Nokia C7. Please see the screenshots:

    It is important to note that after the update of Qt on Nokia e7 some other Qt applications that were working fine now have the same issue with screen rotation.

    Nokia E7 (build with Qt SDK 1.1) after rotating the device to landscape

    !http://anavi.org/images/qtscreensize/qt_problem_e7_01.jpg(landscape)!

    Nokia E7 (build with Qt SDK 1.1) after rotating the device to portrait

    !http://anavi.org/images/qtscreensize/qt_problem_e7_02.jpg(portrait)!

    Nokia C7 (build with Qt SDK 1.0) - no problem

    !http://anavi.org/images/qtscreensize/qt_ok_nokia_c7.jpg(nokia c7)!

    Please note how the background is displayed on Nokia E7 after the update - seems like that landscape and portrait behavior are swapped :(

    Is this a Qt bug or am I doing something wrong? Does anyone of you have the same problem?

    Thanks,
    Leon

    http://anavi.org/

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      Can you post your code that handles the screen orientation related aspects please?

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leon.anavi
        wrote on last edited by
        #3

        Hi ZapB,

        Yes sure!

        Here I handle the resize event
        @
        void MainWindow::resizeEvent(QResizeEvent* event)
        {
        initGuiComponents();
        }
        //--------------------------------------------------------------------------
        @

        After that at initGuiComponents() the screen is obtains as follows:

        @
        QRect Screen = QApplication::desktop()->availableGeometry();
        @

        at main.cpp
        @
        int main(int argc, char *argv[])
        {
        QApplication a(argc, argv);

        MainWindow mainWindow;
        mainWindow.showMaximized();
        
        return a.exec();
        

        }
        @

        I am concerned that it is a backward compatibility issue regarding Qt on Symbian because as I said the same code build with Nokia Qt SDK works as expect and after the update on Nokia E7 my other applications were affected too :(

        10x,
        Leon

        http://anavi.org/

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on last edited by
          #4

          Hi, try adding a function like this to your MainWindow and calling it with ScreenOrientationAuto:

          @
          class MainWindow : public QMainWindow
          {
          Q_OBJECT
          public:
          enum ScreenOrientation {
          ScreenOrientationLockPortrait,
          ScreenOrientationLockLandscape,
          ScreenOrientationAuto
          };

          explicit MainWindow( QWidget* parent = 0 );
          
          void setOrientation( ScreenOrientation orientation );
          {
              Qt::WidgetAttribute attribute;
              switch (orientation) {
              case ScreenOrientationLockPortrait:
                  attribute = Qt::WA_LockPortraitOrientation;
                  break;
              case ScreenOrientationLockLandscape:
                  attribute = Qt::WA_LockLandscapeOrientation;
                  break;
              default:
              case ScreenOrientationAuto:
                  attribute = Qt::WA_AutoOrientation;
                  break;
              };
              setAttribute(attribute, true);
          }
          
          ...
          

          };
          @

          Does that help?

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • L Offline
            L Offline
            leon.anavi
            wrote on last edited by
            #5

            [quote author="ZapB" date="1304875845"]Hi, try adding a function like this to your MainWindow and calling it with ScreenOrientationAuto:[/quote]

            I have already tried this approach - unfortunately it didn't help.

            I have performed another test using a generated project for Symbian for Qt creator. I have self-signed it and wrapped it with the smart installer. Qt Creator automatically generated showExpanded() and setOrientation() which are called at main.cpp.

            Using "Nokia RDA":https://www.forum.nokia.com/Devices/Remote_device_access/ I installed the same theme as on my personal phone and this application on Nokia N8. The same issue appeard:

            !http://anavi.org/images/qtscreensize/qt_problem_n8_01.jpg(nokia n8)!

            The source code of the demo is available "here":http://anavi.org/images/qtscreensize/ScreenRotationTest.zip As I said it is generated by Qt Creator.

            It is important to note that this issue affects only Qt applications. There are no problems with Symbian C++ applications.

            Thanks,
            Leon

            http://anavi.org/

            1 Reply Last reply
            0
            • C Offline
              C Offline
              CMGeorge
              wrote on last edited by
              #6

              First of all, try to replace:
              QRect Screen = QApplication::desktop()->availableGeometry();
              With
              QRect Screen = QApplication::desktop()->screenGeometry();

              After this, set the window geometry to the "Screen" (setGeometry(Screen) , after UI initialisation (if UI is used).

              Take care at minimumSize on designer, that the all "in line" widget to not exceed the 360px resolutin

              Also, add a qDebug/qWarning to the resize method, to be sure that the method is called in resize

              iOS & Qt Developer
              Happy Qt-ing

              1 Reply Last reply
              0
              • L Offline
                L Offline
                leon.anavi
                wrote on last edited by
                #7

                Hi CMGeorge,

                Thank you very much for your valuable advices!

                @
                QRect Screen = QApplication::desktop()->screenGeometry();
                @

                Replacing the code improved the behavior of my controls unfortunately the display of the background image after screen rotation is incorrect.

                [quote author="CMGeorge" date="1305061076"]
                After this, set the window geometry to the "Screen" (setGeometry(Screen) , after UI initialisation (if UI is used).

                Take care at minimumSize on designer, that the all "in line" widget to not exceed the 360px resolutin[/quote]

                UI is not used.

                [quote author="CMGeorge" date="1305061076"]
                Also, add a qDebug/qWarning to the resize method, to be sure that the method is called in resize[/quote]

                Yes, it is called I have checked it using qDebug.

                I updating this issue to solve as I believe the problem with the background backward compatibility issue of the new Qt lib for Symbian.

                Thanks,
                Leon

                http://anavi.org/

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  Fuzzbender
                  wrote on last edited by
                  #8

                  Leon,

                  You are right. It is a problem in Qt 4.7.3. The issue is here: http://bugreports.qt.nokia.com/browse/QTBUG-17930. Unfortunately, fix didn't come in time for that release. :(

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    leon.anavi
                    wrote on last edited by
                    #9

                    Hi Fuzzbender,

                    Thanks for the link. Good to know that the bug is fixed and it will be available at 4.7.4.

                    10x,
                    Leon

                    http://anavi.org/

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved