Solved QPushButton touchscreen problem
-
Goodmorning to all,
I'm trying to create a GUI program using QTcreator. I've bought a Waveshare 3.5 display and I started making some widgets.
I've got a problem with the touchscreen. If I connect a mouse everything is fine and I received signals on my slot functions:void MainWindow::on_pushButton_clicked()
{
qDebug("button pressed");
}void MainWindow::on_pushButton_released()
{
qDebug("button release");
}But if I use touchscreen, instead, QPushButtons slots aren't called and the drawing doesn't get updated. However I can see that events:
void MainWindow::mousePressEvent(QMouseEvent *event)
void MainWindow::mouseMoveEvent(QMouseEvent *event)
void MainWindow::mouseReleaseEvent(QMouseEvent *event)are called correctly. Moreover if I create a QDial widget, the touchscreen works as with mouse.
Looking in the internet, some people had a similar problem that has been resolved calling setAttribute(Qt::WA_AcceptTouchEvents, false); but for me it doesn't work.Can you help me?
Thank you in advanced. -
Hi and welcome to devnet,
Please provide more information about your hardware/software setup.
What version of Qt ?
What OS are you running ?
If Linux, what distribution ?
What input driver are you using ?
What device are you running on ? -
@SGaist Hello SGaist,
thank you very much for your answer. I've build an OS image and sdk with yocto poky-morty so that I could cross compile my applications for a Raspberrypi3.
Qt version is 5.7.1.
I feel a little silly but I found out what was wrong.
Basically my touch was rotated of 180 compare to my screen. So when I pressed on QDial, which is in the middle of the screen, it worked while when I pressed a button on the corner the clicked() release() could not be launched. Thank you anyway.P.S. I've got another problem with libmodus, opened in another thread, could you look at it :) ?