Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Set orientation on embedded device
Forum Updated to NodeBB v4.3 + New Features

Set orientation on embedded device

Scheduled Pinned Locked Moved QML and Qt Quick
10 Posts 3 Posters 4.0k 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.
  • B Offline
    B Offline
    bkamps
    wrote on last edited by
    #1

    I have a C++ application that uses QML for user interface on an embedded device. The embedded device has a 320x240 screen but it's rotated (so it's in portrait mode). I developer and run the application on a normal pc. All the images I made in portrait mode.

    I have defined my main qml as follows:

    @
    Item {
    width: 240
    height: 320

    BorderImage {
       source: "someimage.png"
    }
    

    }
    @

    When I run this on a pc, no problem. When I run this on my embedded device the picture is shown rotated on the up right side of my display.

    To get the picture shown correctly on my embedded device I use the transform option:

    @
    transform: Rotation { id: windowOri; origin.x: 100; origin.y: 140; angle: 270}
    @

    This works for the main page but other (non-fullscreen) windows that are shown on top of the main window are not shown correctly and I need to set the positions "manually":

    @
    PropertyChanges { target: messageWindow; x: 15; y: 70 }
    @

    I am not convinced this is the correct way to set the orientation. I have found many examples but all of them are symbian / meegoo related. I am also not sure if the Rotation option is causing a performance issue...

    Anyone have some suggestions?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

      you can try Page element to set orientation lock if you are developing the app on Harmattan or Symbian device.
      Which platform are you target in ?

      Chuck

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bkamps
        wrote on last edited by
        #3

        I use a custom embedded device, no nokia device... Is using transform : Rotation the way to go?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mbrasser
          wrote on last edited by
          #4

          The flickr and calculator demos in Qt 4.7 give an example of handling rotation purely from QML; if you haven't seen them already they might be worth a look.

          Rotating the entire QML scene will generally have some performance impact. If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240x320 screen geometry).

          Regards,
          Michael

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bkamps
            wrote on last edited by
            #5

            Thanks mbrasser. I have looked at the calculator example and I see that they also use the transform option. The difference is that they "draw" all there qml user interface components while I use images (png files) to show my components. I am not sure if the transform option is efficient for rotating pictures.

            Can you please explain what you mean by this:

            If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240×320 screen geometry).

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

              hi bkamps,
              Can you get it's(the device) orientation?

              I think mbrasser means you can try to handle the rotation in a lower API, which may not the Qt staff. But meanwhile, if you can get the orientation, you can try rotate QML scene to see it's performance.

              Br,
              Chuck

              Chuck

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bkamps
                wrote on last edited by
                #7

                You mean rotate the pictures myself (using a imageeditor) instead of using Rotation? I notice that when I don't rotate on the target the drawing of windows is a lot quicker. Ofcourse I only see a part of the window (because the display is landscape and all my windows/pictures are portrait).

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mbrasser
                  wrote on last edited by
                  #8

                  [quote author="bkamps" date="1340865823"]Can you please explain what you mean by this:

                  If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240×320 screen geometry).
                  [/quote]

                  Sure, I was thinking of, for example, the transformed display driver available for QWS ( http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-displaymanagement.html ).

                  In terms of your QML scene, are you saying the entire UI is a single Image? Or just that it is composed of many Images (rather than Rectangles, Text, etc)?

                  Regards,
                  Michael

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bkamps
                    wrote on last edited by
                    #9

                    [quote author="mbrasser" date="1340930133"][quote author="bkamps" date="1340865823"]Can you please explain what you mean by this: > If possible, you may want to look at handling the rotation lower in the stack (e.g. so Qt sees a 240×320 screen geometry). [/quote] Sure, I was thinking of, for example, the transformed display driver available for QWS ( http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-displaymanagement.html ). In terms of your QML scene, are you saying the entire UI is a single Image? Or just that it is composed of many Images (rather than Rectangles, Text, etc)? Regards, Michael [/quote]

                    The applications consists of multiple images, but also Rectangles and Text..

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mbrasser
                      wrote on last edited by
                      #10

                      [quote author="bkamps" date="1340947047"]The applications consists of multiple images, but also Rectangles and Text..[/quote]

                      I would expect the QML transform to have a performance impact -- from memory QPainter has a number of optimizations that can't be applied when more complex transforms are present. You could try running with the QML_SHOW_FRAMERATE environment variable set to see what sort of performance you get for rotated vs. non-rotated.

                      Regards,
                      Michael

                      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