Qt embedded screen rotation inside app

前端 未结 1 943
旧时难觅i
旧时难觅i 2021-01-07 07:57

In our target device, we run our QtE app with -qws argument. To rotate the screen, we specify \"-display transformed:rot90\" as the app argument and it works well.

H

相关标签:
1条回答
  • 2021-01-07 08:22

    Contrary to other qt documentation, documentation for the embedded part of qt is indeed poor. After few days of fiddling with it, I finally managed to solve it.

    First thing to do is to compile the library with -qt-gfx-transformed option (along with whatever you need).

    Then you compile your application, and start it with the option you already used to activate the transformation driver. I actually started like this :

    export QWS_DISPLAY=Transformed:Rot90:0
    ./app
    

    As a test, I implemented this, to test whether the rotation works :

    class X : public QObject
    {
      Q_OBJECT
    public :
      X() :
        QObject()
      {
        QTimer *t = new QTimer( this );
        connect( t, SIGNAL(timeout()), this, SLOT(OnTimerEvent()));
        t->start( 2500 );
      }
    
    public slots :
      inline void OnTimerEvent()
      {
        static int v = 0;
        ++v;
    
        QWSDisplay::setTransformation(v%4);
    
        std::cout<<v<<std::endl;
      }
    };
    

    So, in the timer slot, I am changing the orientation with QWSDisplay::setTransformation function.

    0 讨论(0)
提交回复
热议问题