2

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.

However, we have a feature to rotate screen inside the app, so we try below API documented in QScreen:

QWSDisplay::setTransformation(QTransformedScreen::Rot90, 0);

But this API doesn't work at all. It's no error message in the console output.

Does anyone know what's going on about this API? Do we need to enable something else?

4

1 回答 1

1

与其他 qt 文档相反,qt 嵌入部分的文档确实很差。经过几天的摆弄,我终于设法解决了它。

首先要做的是使用-qt-gfx-transformed选项编译库(以及您需要的任何内容)。

然后编译您的应用程序,并使用您已用于激活转换驱动程序的选项启动它。我实际上是这样开始的:

export QWS_DISPLAY=Transformed:Rot90:0
./app

作为测试,我实现了这个,以测试旋转是否有效:

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;
  }
};

所以,在定时器槽中,我正在用QWSDisplay::setTransformation函数改变方向。

于 2014-05-06T06:18:39.057 回答