no name no name - 4 days ago 6
C++ Question

when enable Touch Screen in QListWidget double click event not work QT

i use this code to enable touch screen in QListWidget

ui->listWidget->setAttribute(Qt::WA_AcceptTouchEvents,true);
ui->listWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
ui->listWidget->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
QScroller::grabGesture(ui->listWidget,QScroller::TouchGesture);


the touch works great with no problems. but I have a double click signal on the QListWidget, when I double-clicking on an item in list widget the double click slot not work ?

the problem appears especially when the items need to be scrolled (many numbers of item's in list) but if the item's number is small not need to be scroll it works fine
How can I solve this problem
Thanks in Advance

Answer

Try this workaround:

QScroller::grabGesture(ui->listWidget, QScroller::LeftMouseButtonGesture);
Comments