equal
deleted
inserted
replaced
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 } |
887 */ |
890 */ |
888 void QApplicationPrivate::initialize() |
891 void QApplicationPrivate::initialize() |
889 { |
892 { |
890 QWidgetPrivate::mapper = new QWidgetMapper; |
893 QWidgetPrivate::mapper = new QWidgetMapper; |
891 QWidgetPrivate::allWidgets = new QWidgetSet; |
894 QWidgetPrivate::allWidgets = new QWidgetSet; |
|
895 |
|
896 #if !defined(Q_WS_X11) && !defined(Q_WS_QWS) && !defined(Q_CC_NOKIAX86) |
|
897 // initialize the graphics system - on X11 this is initialized inside |
|
898 // qt_init() in qapplication_x11.cpp because of several reasons. |
|
899 // On QWS, the graphics system is set by the QScreen plugin. |
|
900 graphics_system = QGraphicsSystemFactory::create(graphics_system_name); |
|
901 #endif |
|
902 |
892 if (qt_appType != QApplication::Tty) |
903 if (qt_appType != QApplication::Tty) |
893 (void) QApplication::style(); // trigger creation of application style |
904 (void) QApplication::style(); // trigger creation of application style |
894 // trigger registering of QVariant's GUI types |
905 // trigger registering of QVariant's GUI types |
895 qRegisterGuiVariant(); |
906 qRegisterGuiVariant(); |
896 #ifndef QT_NO_STATEMACHINE |
907 #ifndef QT_NO_STATEMACHINE |
921 #endif //Q_WS_WINCE |
932 #endif //Q_WS_WINCE |
922 |
933 |
923 // Set up which span functions should be used in raster engine... |
934 // Set up which span functions should be used in raster engine... |
924 qInitDrawhelperAsm(); |
935 qInitDrawhelperAsm(); |
925 |
936 |
926 #if !defined(Q_WS_X11) && !defined(Q_WS_QWS) |
937 #if defined(Q_CC_NOKIAX86) |
927 // initialize the graphics system - on X11 this is initialized inside |
938 // initialize the graphics system - For symbian emulator, we create graphics system here, since |
928 // qt_init() in qapplication_x11.cpp because of several reasons. |
939 // there is some unknown error launching the emulator with openVg when |
929 // On QWS, the graphics system is set by the QScreen plugin. |
940 // graphics system is created before style instance. |
930 graphics_system = QGraphicsSystemFactory::create(graphics_system_name); |
941 graphics_system = QGraphicsSystemFactory::create(graphics_system_name); |
931 #endif |
942 #endif |
|
943 |
932 #ifndef QT_NO_WHEELEVENT |
944 #ifndef QT_NO_WHEELEVENT |
933 QApplicationPrivate::wheel_scroll_lines = 3; |
945 QApplicationPrivate::wheel_scroll_lines = 3; |
934 #endif |
946 #endif |
935 |
947 |
936 if (qt_is_gui_used) |
948 if (qt_is_gui_used) |
3630 } |
3642 } |
3631 #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT |
3643 #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT |
3632 } |
3644 } |
3633 |
3645 |
3634 // walk through parents and check for gestures |
3646 // walk through parents and check for gestures |
3635 if (qt_gestureManager) { |
3647 if (d->gestureManager) { |
3636 switch (e->type()) { |
3648 switch (e->type()) { |
3637 case QEvent::Paint: |
3649 case QEvent::Paint: |
3638 case QEvent::MetaCall: |
3650 case QEvent::MetaCall: |
3639 case QEvent::DeferredDelete: |
3651 case QEvent::DeferredDelete: |
3640 case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave: |
3652 case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave: |
3662 case QEvent::DynamicPropertyChange: |
3674 case QEvent::DynamicPropertyChange: |
3663 case QEvent::NetworkReplyUpdated: |
3675 case QEvent::NetworkReplyUpdated: |
3664 break; |
3676 break; |
3665 default: |
3677 default: |
3666 if (receiver->isWidgetType()) { |
3678 if (receiver->isWidgetType()) { |
3667 if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) |
3679 if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) |
3668 return true; |
3680 return true; |
3669 } else { |
3681 } else { |
3670 // a special case for events that go to QGesture objects. |
3682 // a special case for events that go to QGesture objects. |
3671 // We pass the object to the gesture manager and it'll figure |
3683 // We pass the object to the gesture manager and it'll figure |
3672 // out if it's QGesture or not. |
3684 // out if it's QGesture or not. |
3673 if (qt_gestureManager->filterEvent(receiver, e)) |
3685 if (d->gestureManager->filterEvent(receiver, e)) |
3674 return true; |
3686 return true; |
3675 } |
3687 } |
3676 } |
3688 } |
3677 } |
3689 } |
3678 |
3690 |
5228 */ |
5240 */ |
5229 QInputContext *QApplication::inputContext() const |
5241 QInputContext *QApplication::inputContext() const |
5230 { |
5242 { |
5231 Q_D(const QApplication); |
5243 Q_D(const QApplication); |
5232 Q_UNUSED(d);// only static members being used. |
5244 Q_UNUSED(d);// only static members being used. |
|
5245 if (QApplicationPrivate::is_app_closing) |
|
5246 return d->inputContext; |
5233 #ifdef Q_WS_X11 |
5247 #ifdef Q_WS_X11 |
5234 if (!X11) |
5248 if (!X11) |
5235 return 0; |
5249 return 0; |
5236 if (!d->inputContext) { |
5250 if (!d->inputContext) { |
5237 QApplication *that = const_cast<QApplication *>(this); |
5251 QApplication *that = const_cast<QApplication *>(this); |
5674 const QList<QTouchEvent::TouchPoint> &touchPoints) |
5688 const QList<QTouchEvent::TouchPoint> &touchPoints) |
5675 { |
5689 { |
5676 QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); |
5690 QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); |
5677 } |
5691 } |
5678 |
5692 |
|
5693 QGestureManager* QGestureManager::instance() |
|
5694 { |
|
5695 QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); |
|
5696 if (!qAppPriv->gestureManager) |
|
5697 qAppPriv->gestureManager = new QGestureManager(qApp); |
|
5698 return qAppPriv->gestureManager; |
|
5699 } |
|
5700 |
5679 QT_END_NAMESPACE |
5701 QT_END_NAMESPACE |
5680 |
5702 |
5681 #include "moc_qapplication.cpp" |
5703 #include "moc_qapplication.cpp" |