Qt 5 embedded screen rotation
-
With Qt4 application rotation of 90, 180 and 270 degree was fairly easy with -qws -display transformed:Rot270.
I've been trying to find the equivalent with Qt 5 with Ogles2/eglfs, starting the application with -platform eglfs command line.
I'm starting to dig through the source and will post an answer if I find it. I'm hoping post the question here will result in a quicker and hopefully more correct solution.
Anyone know the Qt5 equivalent to -qws -display transformed:Rot270?thanks
-
Now,I have the same problem too.
Someone can teach me?
thanks a lot.
-
Does anyone know how to rotate screens on QT5 embedded ?
-
I would also be interested in a general solution.
If you are using qml then you can rotate any root items just by inserting the following. This will rotate all children and even handle touch input correctly.
@
transform: Rotation {
angle: 180
origin.x: root.width / 2
origin.y: root.height / 2
}
@ -
Thanks for JoelC.
But I use Qt Widgets Application.
Any help would be appreciated!
-
I also have this problem. We are porting a c++/qml application from qt4.8 to qt5. We have used transformed:Rot90 and it has worked fine without any performance issues. However if we perform the following in our qml code:
@
transform: Rotation {
angle: 90
}
@the qml part becomes laggy.
Has someone come up with a solution to this?
-
Dear All,
Just one more information that i want to add this is that if you don't want to pass
@-platform eglfs@
the above argument while running your app each time, you can simply store this information in the environment variable :
@export QT_QPA_PLATFORM=eglfs@
And now you can directly run your app without passing any argument.
Cheers!!
-
-
Hello All,
I have same problem. App works fine on Qt4 with QML 1.1 version on both landscape and portrait mode... I use transformed:Rot270.But in Qt5 if I try to rotate my app in QML rootitem by transform: Rotation {
angle: 180
origin.x: root.width / 2
origin.y: root.height / 2
}it does not work properly...only part of the screen is rotated..Any known issues in that area ?
Thanks Kumars -
My solution was: (in mainwindow.cpp-constructor):
QGraphicsScene *scene = new QGraphicsScene(); QGraphicsView *view = new QGraphicsView(parent); view->setGeometry(0,0,X,Y); // actual Display size view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); QGraphicsProxyWidget *proxy = scene->addWidget(this); view->setScene(scene); view->show(); view->rotate(90);
-
@agocs Does this mean that one cannot run a QWidget based application in portrait mode on a natively landscape display? For example, I have a 480x272 display that my hardware team wants to orient in a portrait orientation.
I have tried a number of things including the last suggestion on this thread from 0xFa81 but i end up with garbled text. That's the best way i can explain it. When I run the same code on my development box it works fine and the text is not garbled and show up sideways on my monitor. But if i run it on my embedded device i get text where the letters are switched around.
I started another thread about this here:
-
Hi,
Does Qt rotation is done as part of Qt library/application or as control to framebuffer (which in this case is expected to support rotation).
I ask because in our HW/fbdev driver there is no support for rotation, so I wander if Qt can do this rotation in software...Thanks,
Ran -
@0xFa81 I'm curious if this is the method you are still using.
I'm using this on a product I'm helping with, and the performance is rather slow and is negatively impacting product design requirements (graphing updates per second).
I've tried adjusting the QGraphicsView settings (optimization, etc), but no improvement.
If anyone has found a better way to rotate a landscape LCD to portrait, on a platform using linuxFB (all software driven, no hardware graphics cores at all) help is appreciated.
This platform was previously being developed in Qt4, and the QWS system rotated without any noticeable issues...
Thank you!
Matthew
-
Are there any news about rotating the Display? I do have a Raspberry 7" Display which is landscape native. Using lcd_rotate in the boot config doesnt work (it only works for 180°) and display_rotate misses to rotate the touchscreen. So I need to either rotate the whole thing (touch and display) or just the touchscreen (then I would use the display_rotate). Is there a way to do this?
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=rotate=90
somehow doesnt work for me (should it?)
thanks!
-
Though it is a pretty old query, I think answering to this thread is still valid.
The major difference between Qt4.8 and Qt5.x.x is that, they removed the Qt's own windowing system and let it open for user defined windowing system. That means, QWS (Qt Windowing System) is no more part of the Qt and we can use X11, Wayland or FB as the backend for the same.
If someone want to rotate the screen, then basically that is doing with the help of the windowing system but not just with the Qt itself. As many other people stated, Qt4 rotation is done with the QWS.
If you are using X11 windowing system along with Qt5, then X11 have rotation feature and one should make use of that for the Qt rotation.
I hope this helps.Regards,
Ajith P V -
@tsaG Yes, you are right. "setTransformation" is part of QWSDisplay and in Qt5, they have removed the complete QWS windowing system itself. So as far as my knowledge, there is no equivalent for "setTransformation". However, instead of QWS windowing system, now Qt5 opens to any other popular windows systems such as x11 which can do this trick.
PS: I'm afraid I can't help you with EGLFS since, my qt work is around the corner of X11 almost all time.