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. How to rotate screen in Qt5
Qt 6.11 is out! See what's new in the release blog

How to rotate screen in Qt5

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 4.2k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    hello everyone.I can use "-display transformed:Rot270" to rotate screen in Qt4, but it does not work in Qt5 because qws has eliminated in Qt5. So, how to rotate the screen in Qt5?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jseeQt
      wrote on last edited by
      #2

      Take a look at QScreen and its transformBetween() function.
      This will work as long as you have no desktop enviroment and just one window to show.
      You can get a QScreen with QWindow::screen()....

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        [quote author="jseeQt" date="1413804978"]Take a look at QScreen and its transformBetween() function.
        This will work as long as you have no desktop enviroment and just one window to show.
        You can get a QScreen with QWindow::screen()....[/quote]

        Thanks.I get a QScreen width qAp->screens(),and get a QTransform with QScreen::transformBetween.I take a look at QTransform ,this class can be used to rotate a pixmap,but how to rotate screen by this QTransform.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          add widgets to QGraphicsScene and call QGaphicsProxyWidget::setRotation to rotate the screen.

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            QScreen *s = app.primaryScreen();

            qDebug() << "nativeOrientation: " << s->nativeOrientation();
            qDebug() << "orientation: " << s->orientation();
            qDebug() << (s->isLandscape(s->nativeOrientation()) ? "nativeOrientation lanscape" : "nativeOrientation not lanscape");
            qDebug() << (s->isLandscape(s->orientation()) ? "orientation lanscape" : "orientation not lanscape");
            qDebug() << (s->isPortrait(s->nativeOrientation()) ? "nativeOrientation portrait" : "nativeOrientation not portrait");
            qDebug() << (s->isPortrait(s->orientation()) ? "orientation portrait" : "orientation not portrait");
            
            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