[Kde-games-devel] Fix double-click bug in GameScene code of KMahjongg

Ian Wadham iandw.au at gmail.com
Tue Dec 22 21:43:46 UTC 2015


Hi Frederik,

On 23/12/2015, at 12:37 AM, Frederik Schwarzer wrote:
> Am Sonntag, 20. Dezember 2015, 09:26:29 schrieb Ian Wadham:
>> The QApplication doco on this method is a bit ambiguous, see:
>>    Qt 4 - http://doc.qt.io/qt-4.8/qapplication.html#doubleClickInterval-prop
>>    Qt 5 - http://doc.qt.io/qt-5/qapplication.html#doubleClickInterval-prop
> 
> Indeed. That's scary to read. The behaviour might have been changed to 
> "affects this application only" in Qt5 but who knows until tested on 
> all platforms.
> 
>> So, please remove those two lines from main.cpp and use my patch for
>> KMahjongg's GameScene class files.
> 
> Anyway, I applied your patch. Here it works as the first click selects 
> the tile and the second click is ignored when it occurs within the 
> double-click timespan. Is that what you intended?

Thanks, Frederik.  That is absolutely what I intended, but the patch uses
accept(), rather than ignore(), in the double-click event-handler, and then
performs no action.  That is what I call "swallowing" the event" (old-time
real-time programmer's jargon).

In Qt's Event class, "ignore()" passes the event up the chain for a default
action, which is NOT what is wanted, because it can allow a tile to be
selected and removed invalidly (against the rules of KMahjongg).

Cheers, Ian W.



More information about the kde-games-devel mailing list