Fix one more crash under Qt 5.12

This commit is contained in:
Abs62 2019-04-22 19:50:06 +03:00
parent d62b2d61ba
commit c3ff15f4d8
3 changed files with 9 additions and 7 deletions

View file

@ -45,7 +45,8 @@ QSwipeGesture::SwipeDirection getVerticalDirection( qreal angle )
return QSwipeGesture::NoDirection; return QSwipeGesture::NoDirection;
} }
GDPinchGesture::GDPinchGesture() : GDPinchGesture::GDPinchGesture( QObject * parent ) :
QGesture( parent ),
isNewSequence( true ) isNewSequence( true )
{ {
} }
@ -55,7 +56,7 @@ QGesture * GDPinchGestureRecognizer::create( QObject * pTarget )
if ( pTarget && pTarget->isWidgetType()) { if ( pTarget && pTarget->isWidgetType()) {
static_cast< QWidget * >( pTarget )->setAttribute( Qt::WA_AcceptTouchEvents ); static_cast< QWidget * >( pTarget )->setAttribute( Qt::WA_AcceptTouchEvents );
} }
QGesture *pGesture = new GDPinchGesture; QGesture *pGesture = new GDPinchGesture( pTarget );
return pGesture; return pGesture;
} }
@ -161,7 +162,8 @@ QGestureRecognizer::Result GDPinchGestureRecognizer::recognize( QGesture * state
} }
GDSwipeGesture::GDSwipeGesture() : GDSwipeGesture::GDSwipeGesture( QObject * parent ) :
QGesture( parent ),
vertDirection( QSwipeGesture::NoDirection ), vertDirection( QSwipeGesture::NoDirection ),
horizDirection( QSwipeGesture::NoDirection ), horizDirection( QSwipeGesture::NoDirection ),
started( false ) started( false )
@ -173,7 +175,7 @@ QGesture * GDSwipeGestureRecognizer::create( QObject * pTarget )
if ( pTarget && pTarget->isWidgetType() ) { if ( pTarget && pTarget->isWidgetType() ) {
static_cast< QWidget * >( pTarget )->setAttribute( Qt::WA_AcceptTouchEvents ); static_cast< QWidget * >( pTarget )->setAttribute( Qt::WA_AcceptTouchEvents );
} }
QGesture *pGesture = new GDSwipeGesture; QGesture *pGesture = new GDSwipeGesture( pTarget );
return pGesture; return pGesture;
} }

View file

@ -36,7 +36,7 @@ class GDPinchGestureRecognizer;
class GDPinchGesture : public QGesture class GDPinchGesture : public QGesture
{ {
public: public:
GDPinchGesture(); GDPinchGesture( QObject * parent );
bool isScaleChanged() const bool isScaleChanged() const
{ return scaleChanged; } { return scaleChanged; }
@ -65,7 +65,7 @@ class GDSwipeGestureRecognizer;
class GDSwipeGesture : public QGesture class GDSwipeGesture : public QGesture
{ {
public: public:
GDSwipeGesture(); GDSwipeGesture( QObject * parent );
QSwipeGesture::SwipeDirection getHorizDirection() const QSwipeGesture::SwipeDirection getHorizDirection() const
{ return horizDirection; } { return horizDirection; }
QSwipeGesture::SwipeDirection getVertDirection() const QSwipeGesture::SwipeDirection getVertDirection() const

View file

@ -982,7 +982,7 @@ MainWindow::~MainWindow()
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
ui.centralWidget->ungrabGesture( Gestures::GDPinchGestureType ); ui.centralWidget->ungrabGesture( Gestures::GDPinchGestureType );
ui.centralWidget->ungrabGesture( Gestures::GDSwipeGestureType ); ui.centralWidget->ungrabGesture( Gestures::GDSwipeGestureType );
Gestures::unregisterRecognizers(); // Gestures::unregisterRecognizers();
#endif #endif
// Close all tabs -- they should be destroyed before network managers // Close all tabs -- they should be destroyed before network managers