borkedLabs

QT5 LinuxFB rotation for LCDs patch

I wrote up this patch as I needed to get a landscape display on a LCD which was actually intended for portrait (and so its resolution and framebuffer had to be setup for portrait, it was just physically oriented as landscape). This is a common problem for people using ILI9341/ILI9340 controllers found on cheapo TFT LCDs. These LCDs come setup for a portrait mode on the RGB interface with no option to change it, they do have an SPI interface where you can alter the settings but the display data must always be sent over SPI.

This other problem is going from QT4 to QT5, the transformation options previously available were removed with the old QWS system and now QT5 doesn’t have any way to rotate the image going to the framebuffer.

This patch improves the LinuxFB platform plugin to create an rotation option which can rotate the display by 90,180 and 270 degrees.

Usage is simple, simply append the rotation= parameter with a value of 0,90,180, or 270:

export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:rotation=90

Or use it in the program launch args

-platform linuxfb:fb=/dev/fb0:rotation=90

You need to recompile qtbase to apply this. This was done against QT5.4 but I doubt the files being modified have changed since QT5 was released.

Download here: qt5.4_linuxfb_rotation.patch

comments powered by Disqus