×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Sep 2010
    Location
    Spain
    Posts
    15

    Question Control the orientation with "runtime.orientation"

    I'm using QtSDK 1.1 beta on 64bit Linux, and I'm trying to deploy to s60v5 (5800XM).

    I created a QML app using the QtCreator app wizard. It created some C++ code that it's supposed to control orientation on mobile devices.
    I used runtime.orientation in my QML files to control screen orientation.
    My results are:
    • Desktop
      • Running the app directly doesn't work: seems to not have the runtime object available, so all the layout that depends on it is in wrong places
      • Running qmlviewer with the QML file seems to work: runtime.orientation is available and I can test changes in orientation
    • Mobile device
      • Running the app directly works like running the app in the desktop: the layout that depends on runtime.orientation is in wrong places. A change in orientation in the device triggers a change of width and height only.
      • Running qmlviewer on the mobile device makes the app work "almost" like running qmlviewer on the desktop: runtime.orientation is available (and layout that depends on it is in the right places), BUT a change in orientation only changes screen size, but not changes runtime.orientation (AFAIK), so my transitions don't play, etc.


    So what would be the *right* way to make an app orientation aware, so that it works on mobile devices (without resorting to qmlviewer) and can be tested easily on the desktop? (remember I'm on Linux, so no Simulator)
    Should I use QtMobility as shown in this blog post, or should I rely only on (width>height) comparisons?

  2. #2
    Registered User
    Join Date
    Sep 2010
    Location
    Spain
    Posts
    15

    Re: Control the orientation with "runtime.orientation"

    For some reason, the Qt Simulator wasn't detected by QtCreator. I had to add it manually specifying the Simulator's qmake binary in Tools -> Qt4 -> Qt Versions.
    So the "can be tested easily on the desktop" part is settled.

    Now, any tips on the orientation thing?

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Control the orientation with "runtime.orientation"

    You can check example coming with Qt, to see how to make QML application orientation-aware.
    http://doc.qt.nokia.com/latest/decla...ientation.html

  4. #4
    Registered User
    Join Date
    Sep 2010
    Location
    Spain
    Posts
    15

    Re: Control the orientation with "runtime.orientation"

    Thanks, but that doesn't work for standalone apps, only for apps executed within qmlviewer (there's no executable in that example, only qml).
    Also, that example isn't in my SDK, dunno why.


    But I followed the tips from the blog I posted earlier (with minor modifications) and I successfully implemented a "runtime" object for reading orientation. With the added bonus that I don't have to modify the QML files.


    Btw, I encountered what may possibly be a bug with the inverted portrait orientation:

    This is the app you posted running in my 5800XM, after clicking the "Portrait Inverted" button. The Simulator rotates the screen just fine. It might be a bug with the Qt port to Symbian only.

  5. #5
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Control the orientation with "runtime.orientation"

    You apparently can include any QML file into your QtDeclarative application. However, runtime object is available only in QMLViewer. That's why example won't work with SDK and it was excluded. However, from this bug
    http://bugreports.qt.nokia.com/browse/QTBUG-13351
    it seems that runtime information is available for standalone applications in QtQuick 1.1

Similar Threads

  1. Replies: 6
    Last Post: 2011-05-20, 10:43
  2. Remove "Options" from control pane in runtime
    By elviin in forum Symbian User Interface
    Replies: 3
    Last Post: 2009-08-07, 06:44
  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. How to "Switch Orientation"
    By jömö in forum Mobile Java General
    Replies: 6
    Last Post: 2007-12-06, 12:04
  5. How to modify the control pane label "OK" and "Cancel" of Text Setting item
    By misfit.physics in forum Symbian User Interface
    Replies: 5
    Last Post: 2007-02-27, 05:39

Posting Permissions

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