src/gui/kernel/qapplication.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 5 d3bac044e0f0
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   175 #endif
   175 #endif
   176 #if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
   176 #if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
   177     directPainters = 0;
   177     directPainters = 0;
   178 #endif
   178 #endif
   179 
   179 
       
   180     gestureManager = 0;
   180     gestureWidget = 0;
   181     gestureWidget = 0;
   181 
   182 
   182     if (!self)
   183     if (!self)
   183         self = this;
   184         self = this;
   184 }
   185 }
  3630         }
  3631         }
  3631 #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
  3632 #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
  3632     }
  3633     }
  3633 
  3634 
  3634     // walk through parents and check for gestures
  3635     // walk through parents and check for gestures
  3635     if (qt_gestureManager) {
  3636     if (d->gestureManager) {
  3636         switch (e->type()) {
  3637         switch (e->type()) {
  3637         case QEvent::Paint:
  3638         case QEvent::Paint:
  3638         case QEvent::MetaCall:
  3639         case QEvent::MetaCall:
  3639         case QEvent::DeferredDelete:
  3640         case QEvent::DeferredDelete:
  3640         case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
  3641         case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
  3662         case QEvent::DynamicPropertyChange:
  3663         case QEvent::DynamicPropertyChange:
  3663         case QEvent::NetworkReplyUpdated:
  3664         case QEvent::NetworkReplyUpdated:
  3664             break;
  3665             break;
  3665         default:
  3666         default:
  3666             if (receiver->isWidgetType()) {
  3667             if (receiver->isWidgetType()) {
  3667                 if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
  3668                 if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
  3668                     return true;
  3669                     return true;
  3669             } else {
  3670             } else {
  3670                 // a special case for events that go to QGesture objects.
  3671                 // a special case for events that go to QGesture objects.
  3671                 // We pass the object to the gesture manager and it'll figure
  3672                 // We pass the object to the gesture manager and it'll figure
  3672                 // out if it's QGesture or not.
  3673                 // out if it's QGesture or not.
  3673                 if (qt_gestureManager->filterEvent(receiver, e))
  3674                 if (d->gestureManager->filterEvent(receiver, e))
  3674                     return true;
  3675                     return true;
  3675             }
  3676             }
  3676         }
  3677         }
  3677     }
  3678     }
  3678 
  3679 
  5228 */
  5229 */
  5229 QInputContext *QApplication::inputContext() const
  5230 QInputContext *QApplication::inputContext() const
  5230 {
  5231 {
  5231     Q_D(const QApplication);
  5232     Q_D(const QApplication);
  5232     Q_UNUSED(d);// only static members being used.
  5233     Q_UNUSED(d);// only static members being used.
       
  5234     if (QApplicationPrivate::is_app_closing)
       
  5235         return d->inputContext;
  5233 #ifdef Q_WS_X11
  5236 #ifdef Q_WS_X11
  5234     if (!X11)
  5237     if (!X11)
  5235         return 0;
  5238         return 0;
  5236     if (!d->inputContext) {
  5239     if (!d->inputContext) {
  5237         QApplication *that = const_cast<QApplication *>(this);
  5240         QApplication *that = const_cast<QApplication *>(this);
  5674                                             const QList<QTouchEvent::TouchPoint> &touchPoints)
  5677                                             const QList<QTouchEvent::TouchPoint> &touchPoints)
  5675 {
  5678 {
  5676     QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
  5679     QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
  5677 }
  5680 }
  5678 
  5681 
       
  5682 QGestureManager* QGestureManager::instance()
       
  5683 {
       
  5684     QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
       
  5685     if (!qAppPriv->gestureManager)
       
  5686         qAppPriv->gestureManager = new QGestureManager(qApp);
       
  5687     return qAppPriv->gestureManager;
       
  5688 }
       
  5689 
  5679 QT_END_NAMESPACE
  5690 QT_END_NAMESPACE
  5680 
  5691 
  5681 #include "moc_qapplication.cpp"
  5692 #include "moc_qapplication.cpp"