Qt embedded screen rotation inside app

杀马特。学长 韩版系。学妹 提交于 2019-12-01 00:45:46

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!