cepko84
cepko84

Reputation: 1

Screen rotation when launching PyQt5 application on linux without X server

I have orangepi4 running on ubuntu server without xorg and mipi display for it. By default, the screen orientation is portrait. I have developed a PyQt5 application that, when launched with an hdmi monitor connected, displays correctly with landscape orientation. But when switching to the mipi display, it is displayed with portrait orientation. Is there a way to make it work on a mipi display (with a touchscreen) with landscape orientation (i.e. make a 90 degree rotation)? Maybe I should modify the application code or install xorg without a desktop environment, or something else.

Running pyqt5 app:

QT_QPA_PLATFORM=linuxfb python3 run.py

I tried to find the PyQt5 code that will allow to rotate the entire screen of the application, I also tried to rotate the screen using fbcon (this works for the console, but when the application is launched, it is displayed with portrait orientation)

Example application:

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel

def window():
   app = QApplication(sys.argv)
   widget = QWidget()
   textLabel = QLabel(widget)
   textLabel.setText("Hello World!")
   textLabel.move(100,100)
   widget.show()
   sys.exit(app.exec_())

if __name__ == '__main__':
   window()

View: image on the HDMI monitor and MIPI-DSI touchscreen

Upvotes: 0

Views: 120

Answers (0)

Related Questions