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

Sebastian Diel sdiel at funkmachine.de
Sat Jul 25 21:39:15 CEST 2015


Hi Michael & List,

Am 25.07.2015 um 21:12 schrieb Michael Coffey:
> 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.
Srsly? Complicated in what respects?

Frankly, it's just adding the FlickCharm class into your project and 
write 3 lines per flickable Widget - as I said, even I managed to do 
this^^.
Works flawlessly on every single one of my QWidget derived classes and 
I've actually never spent much brainwork on *how* it does this...

Perhaps I am missing something, but I can't think of a "simpler" 
solution :) It is LPGL, though, as it is part of the Qt demos.

Best Regards,
Sebastian


>
> ------------------------------------------------------------------------
> *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 
>> <mailto:Android-development at qt-project.org>
>> http://lists.qt-project.org/mailman/listinfo/android-development
>
>
> -- 
> http://www.classintouch.de <http://www.classintouch.de/>  - Tablet-Software für Lehrer
>
>
>
>
> _______________________________________________
> 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/98e94931/attachment.html>


More information about the Android-development mailing list