diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/kernel.pri | 3 | ||||
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 76 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qevent.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qeventdispatcher_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qformlayout.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qmultitouch_mac.mm | 1 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qwidgetaction.cpp | 4 |
13 files changed, 72 insertions, 64 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 8859358..7d0e5c7 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -188,9 +188,8 @@ embedded { HEADERS += \ kernel/qeventdispatcher_glib_qws_p.h QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB + LIBS_PRIVATE +=$$QT_LIBS_GLIB } - - } !embedded:!x11:mac { diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 4b8f6a0..4764a2d 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4105,8 +4105,17 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } else if (widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) { break; } + QPoint offset = widget->pos(); widget = widget->parentWidget(); - d->updateTouchPointsForWidget(widget, touchEvent); + touchEvent->setWidget(widget); + for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) { + QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i]; + QRectF rect = pt.rect(); + rect.moveCenter(offset); + pt.d->rect = rect; + pt.d->startPos = pt.startPos() + offset; + pt.d->lastPos = pt.lastPos() + offset; + } } touchEvent->setAccepted(eventAccepted); @@ -5417,9 +5426,11 @@ void QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven const QPointF delta = screenPos - screenPos.toPoint(); rect.moveCenter(widget->mapFromGlobal(screenPos.toPoint()) + delta); - touchPoint.setRect(rect); - touchPoint.setStartPos(widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta); - touchPoint.setLastPos(widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta); + touchPoint.d->rect = rect; + if (touchPoint.state() == Qt::TouchPointPressed) { + touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta; + touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta; + } } } @@ -5463,16 +5474,20 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, for (int i = 0; i < touchPoints.count(); ++i) { QTouchEvent::TouchPoint touchPoint = touchPoints.at(i); + // explicitly detach from the original touch point that we got, so even + // if the touchpoint structs are reused, we will make a copy that we'll + // deliver to the user (which might want to store the struct for later use). + touchPoint.d = touchPoint.d->detach(); // update state - QWidget *widget = 0; + QWeakPointer<QWidget> widget; switch (touchPoint.state()) { case Qt::TouchPointPressed: { if (deviceType == QTouchEvent::TouchPad) { // on touch-pads, send all touch points to the same widget widget = d->widgetForTouchPointId.isEmpty() - ? 0 + ? QWeakPointer<QWidget>() : d->widgetForTouchPointId.constBegin().value(); } @@ -5489,20 +5504,21 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, if (deviceType == QTouchEvent::TouchScreen) { int closestTouchPointId = d->findClosestTouchPointId(touchPoint.screenPos()); - QWidget *closestWidget = d->widgetForTouchPointId.value(closestTouchPointId); + QWidget *closestWidget = d->widgetForTouchPointId.value(closestTouchPointId).data(); if (closestWidget - && (widget->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget))) { + && (widget.data()->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget.data()))) { widget = closestWidget; } } d->widgetForTouchPointId[touchPoint.id()] = widget; - touchPoint.setStartScreenPos(touchPoint.screenPos()); - touchPoint.setLastScreenPos(touchPoint.screenPos()); - touchPoint.setStartNormalizedPos(touchPoint.normalizedPos()); - touchPoint.setLastNormalizedPos(touchPoint.normalizedPos()); + touchPoint.d->startScreenPos = touchPoint.screenPos(); + touchPoint.d->lastScreenPos = touchPoint.screenPos(); + touchPoint.d->startNormalizedPos = touchPoint.normalizedPos(); + touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos(); if (touchPoint.pressure() < qreal(0.)) - touchPoint.setPressure(qreal(1.)); + touchPoint.d->pressure = qreal(1.); + d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint); break; } @@ -5513,12 +5529,14 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, continue; QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id()); - touchPoint.setStartScreenPos(previousTouchPoint.startScreenPos()); - touchPoint.setLastScreenPos(previousTouchPoint.screenPos()); - touchPoint.setStartNormalizedPos(previousTouchPoint.startNormalizedPos()); - touchPoint.setLastNormalizedPos(previousTouchPoint.normalizedPos()); + touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); + touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); + touchPoint.d->startPos = previousTouchPoint.startPos(); + touchPoint.d->lastPos = previousTouchPoint.pos(); + touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); + touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); if (touchPoint.pressure() < qreal(0.)) - touchPoint.setPressure(qreal(0.)); + touchPoint.d->pressure = qreal(0.); break; } default: @@ -5528,23 +5546,25 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id())); QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id()); - touchPoint.setStartScreenPos(previousTouchPoint.startScreenPos()); - touchPoint.setLastScreenPos(previousTouchPoint.screenPos()); - touchPoint.setStartNormalizedPos(previousTouchPoint.startNormalizedPos()); - touchPoint.setLastNormalizedPos(previousTouchPoint.normalizedPos()); + touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); + touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); + touchPoint.d->startPos = previousTouchPoint.startPos(); + touchPoint.d->lastPos = previousTouchPoint.pos(); + touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); + touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); if (touchPoint.pressure() < qreal(0.)) - touchPoint.setPressure(qreal(1.)); + touchPoint.d->pressure = qreal(1.); d->appCurrentTouchPoints[touchPoint.id()] = touchPoint; break; } - Q_ASSERT(widget != 0); + Q_ASSERT(widget.data() != 0); // make the *scene* functions return the same as the *screen* functions - touchPoint.setSceneRect(touchPoint.screenRect()); - touchPoint.setStartScenePos(touchPoint.startScreenPos()); - touchPoint.setLastScenePos(touchPoint.lastScreenPos()); + touchPoint.d->sceneRect = touchPoint.screenRect(); + touchPoint.d->startScenePos = touchPoint.startScreenPos(); + touchPoint.d->lastScenePos = touchPoint.lastScreenPos(); - StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[widget]; + StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[widget.data()]; maskAndPoints.first |= touchPoint.state(); if (touchPoint.isPrimary()) maskAndPoints.first |= Qt::TouchPointPrimary; diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 992e4be..14d7215 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -511,7 +511,7 @@ public: QWidget *gestureWidget; - QMap<int, QWidget *> widgetForTouchPointId; + QMap<int, QWeakPointer<QWidget> > widgetForTouchPointId; QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints; static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent); void initializeMultitouch(); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 04e4b31..c7f0c00 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -323,7 +323,6 @@ QSymbianControl::QSymbianControl(QWidget *w) , qwidget(w) , m_longTapDetector(0) , m_ignoreFocusChanged(0) - , m_previousEventLongTap(0) , m_symbianPopupIsOpen(0) { } @@ -362,9 +361,6 @@ QSymbianControl::~QSymbianControl() setFocusSafely(false); S60->appUi()->RemoveFromStack(this); delete m_longTapDetector; - - if(m_previousEventLongTap) - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & ~Qt::RightButton; } void QSymbianControl::setWidget(QWidget *w) @@ -379,19 +375,11 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons alienWidget = qwidget->childAt(widgetPos); if (!alienWidget) alienWidget = qwidget; - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~Qt::LeftButton); - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | Qt::RightButton; - QMouseEvent mEvent(QEvent::MouseButtonPress, alienWidget->mapFrom(qwidget, widgetPos), globalPos, - Qt::RightButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier); - - bool res = sendMouseEvent(alienWidget, &mEvent); #if !defined(QT_NO_CONTEXTMENU) - QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, mEvent.modifiers()); + QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, Qt::NoModifier); qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent); #endif - - m_previousEventLongTap = true; } #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER @@ -515,12 +503,6 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) mapS60MouseEventTypeToQt(&type, &button, &pEvent); Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); - if (m_previousEventLongTap) - if (type == QEvent::MouseButtonRelease){ - button = Qt::RightButton; - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & ~Qt::RightButton; - m_previousEventLongTap = false; - } if (type == QMouseEvent::None) return; diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 9839269..461cc92 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -787,6 +787,8 @@ public: private: QTouchEventTouchPointPrivate *d; + friend class QApplication; + friend class QApplicationPrivate; }; enum DeviceType { @@ -818,6 +820,7 @@ protected: Qt::TouchPointStates _touchPointStates; QList<QTouchEvent::TouchPoint> _touchPoints; + friend class QApplication; friend class QApplicationPrivate; }; diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp index 9d18c9b..4c1429a 100644 --- a/src/gui/kernel/qeventdispatcher_s60.cpp +++ b/src/gui/kernel/qeventdispatcher_s60.cpp @@ -92,7 +92,7 @@ void QEventDispatcherS60::saveInputEvent(QSymbianControl *control, QWidget *widg { DeferredInputEvent inputEvent = {control, widget, event}; m_deferredInputEvents.append(inputEvent); - connect(widget, SIGNAL(destroyed(QObject *)), SLOT(removeInputEventsForWidget(QObject *))); + connect(widget, SIGNAL(destroyed(QObject*)), SLOT(removeInputEventsForWidget(QObject*))); } bool QEventDispatcherS60::sendDeferredInputEvents() diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp index 3e5dadc..33f5489 100644 --- a/src/gui/kernel/qformlayout.cpp +++ b/src/gui/kernel/qformlayout.cpp @@ -1124,14 +1124,15 @@ QStyle* QFormLayoutPrivate::getStyle() const \value DontWrapRows Fields are always laid out next to their label. This is - the default policy for all styles except Qt Extended styles. + the default policy for all styles except Qt Extended styles + and QS60Style. \value WrapLongRows Labels are given enough horizontal space to fit the widest label, and the rest of the space is given to the fields. If the minimum size of a field pair is wider than the available space, the field is wrapped to the next line. This is the default policy for - Qt Extended styles. + Qt Extended styles and and QS60Style. \value WrapAllRows Fields are always laid out below their label. @@ -1720,8 +1721,8 @@ QFormLayout::FieldGrowthPolicy QFormLayout::fieldGrowthPolicy() const \brief the way in which the form's rows wrap The default value depends on the widget or application style. For - Qt Extended styles, the default is WrapLongRows; for the other styles, - the default is DontWrapRows. + Qt Extended styles and QS60Style, the default is WrapLongRows; + for the other styles, the default is DontWrapRows. If you want to display each label above its associated field (instead of next to it), set this property to WrapAllRows. diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 89c18fb..e3af683 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1036,7 +1036,7 @@ QKeySequence QKeySequence::mnemonic(const QString &text) #else found = true; } else { - qWarning(qPrintable(QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurences of '&'").arg(text))); + qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurences of '&'", qPrintable(text)); #endif } } diff --git a/src/gui/kernel/qmultitouch_mac.mm b/src/gui/kernel/qmultitouch_mac.mm index 2f6f9ca..f736146 100644 --- a/src/gui/kernel/qmultitouch_mac.mm +++ b/src/gui/kernel/qmultitouch_mac.mm @@ -180,7 +180,6 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch) if (_touchCount != _currentTouches.size()) { // Remove all instances, and basically start from scratch: touchPoints.clear(); - QList<QCocoaTouch *> list = _currentTouches.values(); foreach (QCocoaTouch *qcocoaTouch, _currentTouches.values()) { if (!_updateInternalStateOnly) { qcocoaTouch->_touchPoint.setState(Qt::TouchPointReleased); diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 22ac319..775d773 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -210,6 +210,10 @@ bool QSoftKeyManager::event(QEvent *e) #ifdef Q_WS_S60 void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys) { + // lets not update softkeys if s60 native dialog or menu is shown + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) + return; + CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); nativeContainer->DrawableWindow()->SetOrdinalPosition(0); nativeContainer->DrawableWindow()->SetPointerCapturePriority(1); //keep softkeys available in modal dialog diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index ec8c9cb..08f8bb5 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -204,7 +204,6 @@ private: QWidget *qwidget; QLongTapTimer* m_longTapDetector; bool m_ignoreFocusChanged : 1; - bool m_previousEventLongTap : 1; bool m_symbianPopupIsOpen : 1; #ifdef Q_WS_S60 diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 0d8da0c..709f6f3 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4677,8 +4677,10 @@ void QWidgetPrivate::resolveLayoutDirection() By default, this property is set to Qt::LeftToRight. When the layout direction is set on a widget, it will propagate to - the widget's children. Children added after the call to \c - setLayoutDirection() will not inherit the parent's layout + the widget's children, but not to a child that is a window and not + to a child for which setLayoutDirection() has been explicitly + called. Also, child widgets added \e after setLayoutDirection() + has been called for the parent do not inherit the parent's layout direction. \sa QApplication::layoutDirection @@ -11869,8 +11871,7 @@ void QWidget::ungrabGesture(Qt::GestureType gesture) isVisible() returns false for a widget, that widget cannot call grabMouse(). - \sa releaseMouse() grabKeyboard() releaseKeyboard() grabKeyboard() - focusWidget() + \sa releaseMouse() grabKeyboard() releaseKeyboard() */ /*! diff --git a/src/gui/kernel/qwidgetaction.cpp b/src/gui/kernel/qwidgetaction.cpp index 7dc2c67..b72a41a 100644 --- a/src/gui/kernel/qwidgetaction.cpp +++ b/src/gui/kernel/qwidgetaction.cpp @@ -212,8 +212,8 @@ void QWidgetAction::releaseWidget(QWidget *widget) if (!d->createdWidgets.contains(widget)) return; - disconnect(widget, SIGNAL(destroyed(QObject *)), - this, SLOT(_q_widgetDestroyed(QObject *))); + disconnect(widget, SIGNAL(destroyed(QObject*)), + this, SLOT(_q_widgetDestroyed(QObject*))); d->createdWidgets.removeAll(widget); deleteWidget(widget); } |