[Android-development] touch-scrolling a custom widget and double-click

Michael Coffey xaffeine-m at yahoo.com
Sat Jul 25 21:12:36 CEST 2015


I have found an answer that works for me, but it feels more like a "workaround" than a clean solution. 

If I pass QScroller::LeftMouseButtonGesture as a type argument to grabGesture(), I get the behavior I want. I also do my own double-click detection and ignore other mouse events in my class that implements a custom widget that is contained within my GridWidget. I'm not sure if all this was 100% necessary, but some of it is.

Does anyone happen to know if there is a simpler way to do this? I looked at FlickCharm, but that entails a more complicated approach.

      From: Sebastian Diel <sdiel at funkmachine.de>
 To: Michael Coffey <xaffeine-m at yahoo.com> 
 Sent: Saturday, July 25, 2015 11:26 AM
 Subject: Re: [Android-development] touch-scrolling a custom widget and double-click
   
 Hi Michael, 
 
 have you tried the FlickCharm? That one proved so easy to use that even I could work with it :-)
 (Worked on Android 4x and Windows, no other systems tested)
 
 Use it like this:
     FlickCharm *flickCharm = new FlickCharm(this);
     flickCharm->setScrollBarVisibility(scrollVisibility);
     flickCharm->activateOn(tableWidget);
 
 BR
 Sebastian
 
 Am 25.07.2015 um 19:08 schrieb Michael Coffey:
  
 

I have developed a widget-based application that works well in linux and Windows. It mostly works in Android, too, but I haven't been able to get scrolling to work right.     
 
            
  Most of my UI is inside a custom subclass of QWidget called GridWidget. This widget sits inside of a QScrollArea, which is also the central widget of my  QMainWindow. I have a pointer variable, m_gridWidget, pointing to this custom widget. Some of the children of my GridWidget need to be double-clickable. The  GridWidget, itself, needs to flick-scroll.
  
  To enable gesture-scrolling, I call QScroller::grabGesture, in a sequence like the following:
 QScrollArea * scroller = new QScrollArea();
 setCentralWidget( scroller );
 m_gridWidget = new GridWidget;
 scroller->setWidget( m_gridWidget );
 QScroller::grabGesture( centralWidget() ); 
  The grabGesture() does enable scrolling but it disables double-clicks on most of the children of the gridWidget. Interestingly, child widgets  inside the gridWidget get to see clicks, but they do not see double-clicks. I have a workaround for that subproblem by implementing mouseReleaseEvent for a child widget class. 
  More importantly, flick-scrolling the main widget only works in the part  of the widget where there are no child widgets. I want to be able to initiate the gesture anywhere in the region.
  
   How can I get this to work on Android? I am currently using QT  5.5 and testing on Android 5.0.2. 
                  
  
 _______________________________________________
Android-development mailing list
Android-development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/android-development
 
 
 
 -- 
http://www.classintouch.de - Tablet-Software für Lehrer 

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20150725/9db80735/attachment.html>


More information about the Android-development mailing list