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. Qt6 QScreen setOrientationUpdateMask()
Qt 6.11 is out! See what's new in the release blog

Qt6 QScreen setOrientationUpdateMask()

Scheduled Pinned Locked Moved Solved Mobile and Embedded
2 Posts 1 Posters 1.2k 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.
  • K Offline
    K Offline
    Kuzma30
    wrote on last edited by
    #1

    I use b2qt distro.
    My app is QML based. I need rotate context of the screen by 90degree. I have not accelerometer in my system and screen must be rotated all time.
    After googling I found such example code

        QScreen* screen = QGuiApplication::primaryScreen();
        if(screen){
              screen->setOrientationUpdateMask(Qt::PortraitOrientation);
        }
    

    but it not compile on QT6.
    What is a proper way to hardcode screen orientation for QT6 app?

    K 1 Reply Last reply
    1
    • K Kuzma30

      I use b2qt distro.
      My app is QML based. I need rotate context of the screen by 90degree. I have not accelerometer in my system and screen must be rotated all time.
      After googling I found such example code

          QScreen* screen = QGuiApplication::primaryScreen();
          if(screen){
                screen->setOrientationUpdateMask(Qt::PortraitOrientation);
          }
      

      but it not compile on QT6.
      What is a proper way to hardcode screen orientation for QT6 app?

      K Offline
      K Offline
      Kuzma30
      wrote on last edited by
      #2

      After some research I do
      Window {
      id: root
      contentOrientation: Qt.InvertedLandscapeOrientation
      visible: true

      Rectangle{
          id: root_w
          width: 1920
          height: 1200
          transform: Rotation {
              angle: 270
              origin.x: root.height / 2
              origin.y: root.height / 2
          } 
      

      // code here
      }

      1 Reply Last reply
      0
      • K Kuzma30 has marked this topic as solved on

      • Login

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