Important: Please read the Qt Code of Conduct -

[Solved] Touch screen coordinates are offset in Qt but not when using tslib utilities on Raspberry Pi B+.

  • Hi,

    The platform is a Raspberry Pi Model B+ with a resistive touch screen (using tslib) from eGalax which is connected through the USB controller.

    I have no problems to calibrate and test the touch screen with the ts_test and ts_calib utilities, but when I start the Qt 5.4 application the events are captured by Qt but the touch coordinates are offset appr. 50 pixels.. in both Y and X direction.

    Does anyone have any experiance and solution regarding this problem?


  • Lifetime Qt Champion


    Maybe a silly question but are you sure you are using the calibrated data of tslib ?

  • Thanks for Your comment.. it led me to check the environment variables once again.. I've discovered that Qt sees the HDMI resolution, which in my case is 1280x720 .. but the output from ts_calibrate says 1024x600 which actually is the maximum resolution for the touch screen I use.. and I suppose that tslib gets the resolution from the driver for the touch screen..

    I will try to fix this and I'll post the result here..

    Thanks again!

  • I've finally managed to solve the problem :)

    The resistive touch driver expects the video output to be 1024x600 but the resolution on the Pi was set to a standard resolution of 1280x720

    I found a solution on how to force the Pi to set it's HDMI resolution to a nonstandard which is described at

    Thanks SGaist for pointing me to the right direction!

  • Lifetime Qt Champion

    Great and thanks for sharing the solution !

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solutions has been found :)

Log in to reply