src/gui/kernel/qapplication.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 19 fcece45ef507
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     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 **
   119 
   119 
   120 //#define ALIEN_DEBUG
   120 //#define ALIEN_DEBUG
   121 
   121 
   122 static void initResources()
   122 static void initResources()
   123 {
   123 {
   124 #ifdef Q_WS_WINCE
   124 #if defined(Q_WS_WINCE)
   125     Q_INIT_RESOURCE(qstyle_wince);
   125     Q_INIT_RESOURCE(qstyle_wince);
       
   126 #elif defined(Q_OS_SYMBIAN)
       
   127     Q_INIT_RESOURCE(qstyle_s60);
   126 #else
   128 #else
   127     Q_INIT_RESOURCE(qstyle);
   129     Q_INIT_RESOURCE(qstyle);
   128 #endif
   130 #endif
   129 
   131 
   130     Q_INIT_RESOURCE(qmessagebox);
   132     Q_INIT_RESOURCE(qmessagebox);
   175 #endif
   177 #endif
   176 #if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
   178 #if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
   177     directPainters = 0;
   179     directPainters = 0;
   178 #endif
   180 #endif
   179 
   181 
       
   182     gestureManager = 0;
   180     gestureWidget = 0;
   183     gestureWidget = 0;
   181 
   184 
   182     if (!self)
   185     if (!self)
   183         self = this;
   186         self = this;
   184 }
   187 }
  3630         }
  3633         }
  3631 #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
  3634 #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
  3632     }
  3635     }
  3633 
  3636 
  3634     // walk through parents and check for gestures
  3637     // walk through parents and check for gestures
  3635     if (qt_gestureManager) {
  3638     if (d->gestureManager) {
  3636         switch (e->type()) {
  3639         switch (e->type()) {
  3637         case QEvent::Paint:
  3640         case QEvent::Paint:
  3638         case QEvent::MetaCall:
  3641         case QEvent::MetaCall:
  3639         case QEvent::DeferredDelete:
  3642         case QEvent::DeferredDelete:
  3640         case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
  3643         case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
  3662         case QEvent::DynamicPropertyChange:
  3665         case QEvent::DynamicPropertyChange:
  3663         case QEvent::NetworkReplyUpdated:
  3666         case QEvent::NetworkReplyUpdated:
  3664             break;
  3667             break;
  3665         default:
  3668         default:
  3666             if (receiver->isWidgetType()) {
  3669             if (receiver->isWidgetType()) {
  3667                 if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
  3670                 if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
  3668                     return true;
  3671                     return true;
  3669             } else {
  3672             } else {
  3670                 // a special case for events that go to QGesture objects.
  3673                 // a special case for events that go to QGesture objects.
  3671                 // We pass the object to the gesture manager and it'll figure
  3674                 // We pass the object to the gesture manager and it'll figure
  3672                 // out if it's QGesture or not.
  3675                 // out if it's QGesture or not.
  3673                 if (qt_gestureManager->filterEvent(receiver, e))
  3676                 if (d->gestureManager->filterEvent(receiver, e))
  3674                     return true;
  3677                     return true;
  3675             }
  3678             }
  3676         }
  3679         }
  3677     }
  3680     }
  3678 
  3681 
  5228 */
  5231 */
  5229 QInputContext *QApplication::inputContext() const
  5232 QInputContext *QApplication::inputContext() const
  5230 {
  5233 {
  5231     Q_D(const QApplication);
  5234     Q_D(const QApplication);
  5232     Q_UNUSED(d);// only static members being used.
  5235     Q_UNUSED(d);// only static members being used.
       
  5236     if (QApplicationPrivate::is_app_closing)
       
  5237         return d->inputContext;
  5233 #ifdef Q_WS_X11
  5238 #ifdef Q_WS_X11
  5234     if (!X11)
  5239     if (!X11)
  5235         return 0;
  5240         return 0;
  5236     if (!d->inputContext) {
  5241     if (!d->inputContext) {
  5237         QApplication *that = const_cast<QApplication *>(this);
  5242         QApplication *that = const_cast<QApplication *>(this);
  5674                                             const QList<QTouchEvent::TouchPoint> &touchPoints)
  5679                                             const QList<QTouchEvent::TouchPoint> &touchPoints)
  5675 {
  5680 {
  5676     QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
  5681     QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
  5677 }
  5682 }
  5678 
  5683 
       
  5684 QGestureManager* QGestureManager::instance()
       
  5685 {
       
  5686     QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
       
  5687     if (!qAppPriv->gestureManager)
       
  5688         qAppPriv->gestureManager = new QGestureManager(qApp);
       
  5689     return qAppPriv->gestureManager;
       
  5690 }
       
  5691 
  5679 QT_END_NAMESPACE
  5692 QT_END_NAMESPACE
  5680 
  5693 
  5681 #include "moc_qapplication.cpp"
  5694 #include "moc_qapplication.cpp"