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. Can Qt Quick response to the screen rotation (Symbian)?
Forum Updated to NodeBB v4.3 + New Features

Can Qt Quick response to the screen rotation (Symbian)?

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 5 Posters 8.8k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    changsheng230
    wrote on last edited by
    #1

    Anyone know how to acheive the following screen rotation response using QML on Symbian?

    1. In landscape screen , showing image file of "image1"

    2. After rotating to portrait screen, the showing picture change to "image2"

    I did some searching, the following thread have some clues and written in C++ rather than QML.
    http://developer.qt.nokia.com/forums/viewthread/1452

    Chang Sheng
    常升

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kamalakshantv
      wrote on last edited by
      #2

      QML cannot detect orientation change on its own yet.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        changsheng230
        wrote on last edited by
        #3

        Just find an example about screen orientation, but seems not ideal one for symbian.
        http://doc.qt.nokia.com/4.7-snapshot/declarative-screenorientation-screenorientation-qml.html

        Chang Sheng
        常升

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          You can write orientation changing listener in C++ and use Connections in QML to listen for signal from object that will do it in C++.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kamalakshantv
            wrote on last edited by
            #5

            Using Symbian C++ it is possible to listen to orientation changes. However, AFAIK its not possible to detect that in QML without using C++.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DenisKormalev
              wrote on last edited by
              #6

              QtK, you can do it in pure Qt using QDesktopWidget, it has signal for desktop size changing.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kamalakshantv
                wrote on last edited by
                #7

                It's not using QML right.

                Also in case of QDesktopWidget are you referring to any of these signals.

                @void resized ( int screen )
                void screenCountChanged ( int newCount )
                void workAreaResized ( int screen )@

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DenisKormalev
                  wrote on last edited by
                  #8

                  QtK, I'm saying about resized(), right.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    changsheng230
                    wrote on last edited by
                    #9

                    Found more docs about orientation.
                    My understanding of the this doc, if we intalled qmlviewer on Symbian device, and load the qml file using qmlviewer, orientation should able to be detected at run time

                    http://doc.qt.nokia.com/4.7-snapshot/qmlviewer.html

                    QML applications that are loaded with the QML Viewer have access to a special runtime property on the root context. This property provides additional information about the application's runtime environment through the following properties:

                    runtime.orientation
                    This property indicates the current orientation of the QML Viewer. On the N900 platform and most S60 5.0-based or newer Symbian devices, this property automatically updates to reflect the device's actual orientation; on other platforms, this indicates the orientation currently selected in the QML Viewer's Settings -> Properties menu. The orientation value can be one of the following:

                    • Orientation.Portrait
                    • Orientation.Landscape
                    • Orientation.PortraitInverted (Portrait orientation, upside-down)
                    • Orientation.LandscapeInverted (Landscape orientation, upside-down)

                    When the viewer's orientation changes, the appearance of the loaded QML document does not change unless it has been set to respond to changes in runtime.orientation. For example, the following Rectangle changes its aspect ratio depending on the orientation of the QML Viewer:
                    @
                    Rectangle {
                    id: window
                    width: 640; height: 480

                     states: State {
                         name: "landscape"
                         PropertyChanges { target: window; width: 480; height: 640 }
                     }
                     state: (runtime.orientation == Orientation.Landscape
                             || runtime.orientation == Orientation.LandscapeInverted) ? 'landscape' : ''
                    

                    } @

                    Chang Sheng
                    常升

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      shullw
                      wrote on last edited by
                      #10

                      I came up with a little bit of a solution for this. I have an image that I wanted to go away when in landscape but still needed its height for calculations in other blocks. The key for this process to work is I have one block containing the whole program called

                      @
                      id:wholeBlock
                      @

                      This block adjusts to the size of the screen so for the height of the image I put in.

                      @
                      height: wholeBlock.width>wholeBlock.height ? 0 : 200
                      @

                      So if the width is greater than the height of the whole screen it sets the size to 0 or on the flip it sets it to 200. Hope this little bit of trickery can help someone out.

                      A QML Purest Point of View!

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        alexander
                        wrote on last edited by
                        #11

                        I also used this trick:)
                        @Image {
                        source: {
                        if ( mainItem.height > mainItem.widht )
                        return "logo1.png"
                        else
                        return "logo2.png"
                        }
                        }@

                        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