diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-01-28 18:27:28 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-01-28 18:27:28 +0100 |
commit | a4ea0d9eacd574a6a96f70b138dcb111e9d11d21 (patch) | |
tree | 3c6439e1c9007e20bb0e8665cdba36c675b4a78f /src/widgets | |
parent | ef442327b8a4122fe46462e95a0537ec5ac53cb6 (diff) | |
parent | 6c3eb39832876a65291546476b92fd94950b1208 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia5727ce68001bcaab467f5fae3a4933d1217015f
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/doc/snippets/javastyle.cpp | 4 | ||||
-rw-r--r-- | src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc | 12 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 1 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.h | 1 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 16 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.h | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 20 | ||||
-rw-r--r-- | src/widgets/widgets/qbuttongroup.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qbuttongroup.h | 12 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 37 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox_p.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qscrollarea.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qspinbox.cpp | 48 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 40 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol_p.h | 2 |
18 files changed, 146 insertions, 71 deletions
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp index 54a4ade921..1d18b45c37 100644 --- a/src/widgets/doc/snippets/javastyle.cpp +++ b/src/widgets/doc/snippets/javastyle.cpp @@ -380,10 +380,10 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option, QRect rect = bar->rect; if (bar->orientation == Qt::Vertical) { rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); - QMatrix m; + QTransform m; m.translate(rect.height()-1, 0); m.rotate(90.0); - painter->setMatrix(m); + painter->setTransform(m); } painter->setPen(bar->palette.color(QPalette::Mid)); diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 35bad6786a..50f626e7a6 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -2543,6 +2543,18 @@ See also \l{#height-prop}{height}. + \row + \li \b -qt-background-role + \li \l{#paletterole}{PaletteRole} + \li The \c{background-color} for the subcontrol or widget based on the + chosen role. + + \row + \li \b -qt-style-features + \li \c list + \li The list of CSS properties that you want to apply Qt-specific styles on. + + \note The \c list can only include properties that are not pixmap-based. \endtable \target list of icons diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 1cb24f74b6..bbcceb1ce6 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -231,7 +231,6 @@ #include <QtWidgets/qgraphicslayout.h> #include <QtWidgets/qgraphicsproxywidget.h> #include <QtWidgets/qgraphicswidget.h> -#include <QtGui/qmatrix.h> #include <QtGui/qpaintengine.h> #include <QtGui/qpainter.h> #include <QtGui/qpixmapcache.h> diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index e72ed99a7b..e459b80970 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -47,7 +47,6 @@ #include <QtGui/qbrush.h> #include <QtGui/qfont.h> #include <QtGui/qtransform.h> -#include <QtGui/qmatrix.h> #include <QtGui/qpen.h> QT_REQUIRE_CONFIG(graphicsview); diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 102f3e894f..686b41960a 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1795,7 +1795,13 @@ void QGraphicsView::setSceneRect(const QRectF &rect) d->recalculateContentSize(); } +#if QT_DEPRECATED_SINCE(5, 15) + /*! + \obsolete + + Use transform() instead. + Returns the current transformation matrix for the view. If no current transformation is set, the identity matrix is returned. @@ -1808,6 +1814,10 @@ QMatrix QGraphicsView::matrix() const } /*! + \obsolete + + Use setTransform() instead. + Sets the view's current transformation matrix to \a matrix. If \a combine is true, then \a matrix is combined with the current matrix; @@ -1839,6 +1849,10 @@ void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine) } /*! + \obsolete + + Use resetTransform() instead. + Resets the view transformation matrix to the identity matrix. \sa resetTransform() @@ -1848,6 +1862,8 @@ void QGraphicsView::resetMatrix() resetTransform(); } +#endif // QT_DEPRECATED_SINCE(5, 15) + /*! Rotates the current view transformation \a angle degrees clockwise. diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 1389796c3f..e98ec52d8f 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -165,9 +165,11 @@ public: void setSceneRect(const QRectF &rect); inline void setSceneRect(qreal x, qreal y, qreal w, qreal h); - QMatrix matrix() const; - void setMatrix(const QMatrix &matrix, bool combine = false); - void resetMatrix(); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transform()") QMatrix matrix() const; + QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &matrix, bool combine = false); + QT_DEPRECATED_X("Use resetTransform()") void resetMatrix(); +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform transform() const; QTransform viewportTransform() const; bool isTransformed() const; diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 68f6b72d20..129569a466 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2124,7 +2124,8 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool && !(!next && focusProxy && test->isAncestorOf(focusProxy)) && test->isVisibleTo(toplevel) && test->isEnabled() && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) - && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { + && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test)) + && f != focusProxy) { w = test; if (seenWindow) focusWidgetAfterWindow = true; diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index c241f7a936..1e5830d216 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1556,7 +1556,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, qint64 maximum = qint64(pb->maximum); qint64 progress = qint64(pb->progress); - QMatrix m; + QTransform m; if (vertical) { rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 497afd17e1..105eba370a 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -1692,7 +1692,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai const bool vertical = pb->orientation == Qt::Vertical; const bool inverted = pb->invertedAppearance; - QMatrix m; + QTransform m; if (vertical) { rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height m.rotate(90); diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 29d28847f3..7c26b8cc42 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -414,8 +414,13 @@ void QAbstractButtonPrivate::emitClicked() emit q->clicked(checked); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonClicked(group->id(q)); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonClicked(q); } #endif @@ -428,8 +433,13 @@ void QAbstractButtonPrivate::emitPressed() emit q->pressed(); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonPressed(group->id(q)); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonPressed(q); } #endif @@ -442,8 +452,13 @@ void QAbstractButtonPrivate::emitReleased() emit q->released(); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonReleased(group->id(q)); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonReleased(q); } #endif @@ -456,8 +471,13 @@ void QAbstractButtonPrivate::emitToggled(bool checked) emit q->toggled(checked); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonToggled(group->id(q), checked); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonToggled(q, checked); } #endif diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index c3fd37d8e9..9162029cdb 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -164,6 +164,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonClicked(int id) + \obsolete This signal is emitted when a button with the given \a id is clicked. @@ -183,6 +184,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonPressed(int id) \since 4.2 + \obsolete This signal is emitted when a button with the given \a id is pressed down. @@ -202,6 +204,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonReleased(int id) \since 4.2 + \obsolete This signal is emitted when a button with the given \a id is released. @@ -222,6 +225,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonToggled(int id, bool checked) \since 5.2 + \obsolete This signal is emitted when a button with the given \a id is toggled. \a checked is true if the button is checked, or false if the button is unchecked. diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h index fec94ccb3e..2989dcb4ba 100644 --- a/src/widgets/widgets/qbuttongroup.h +++ b/src/widgets/widgets/qbuttongroup.h @@ -78,13 +78,19 @@ public: Q_SIGNALS: void buttonClicked(QAbstractButton *); - void buttonClicked(int); void buttonPressed(QAbstractButton *); - void buttonPressed(int); void buttonReleased(QAbstractButton *); - void buttonReleased(int); void buttonToggled(QAbstractButton *, bool); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonClicked(QAbstractButton *) instead") + void buttonClicked(int); + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonPressed(QAbstractButton *) instead") + void buttonPressed(int); + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonReleased(QAbstractButton *) instead") + void buttonReleased(int); + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonToggled(QAbstractButton *, bool) instead") void buttonToggled(int, bool); +#endif private: Q_DISABLE_COPY(QButtonGroup) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 53a711adc4..9789004473 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -293,8 +293,7 @@ void QComboBoxPrivate::_q_modelReset() lineEdit->setText(QString()); updateLineEditGeometry(); } - if (currentIndex.row() != indexBeforeChange) - _q_emitCurrentIndexChanged(currentIndex); + trySetValidIndex(); modelChanged(); q->update(); } @@ -304,6 +303,25 @@ void QComboBoxPrivate::_q_modelDestroyed() model = QAbstractItemModelPrivate::staticEmptyModel(); } +void QComboBoxPrivate::trySetValidIndex() +{ + Q_Q(QComboBox); + bool currentReset = false; + + const int rowCount = q->count(); + for (int pos = 0; pos < rowCount; ++pos) { + const QModelIndex idx(model->index(pos, modelColumn, root)); + if (idx.flags() & Qt::ItemIsEnabled) { + setCurrentIndex(idx); + currentReset = true; + break; + } + } + + if (!currentReset) + setCurrentIndex(QModelIndex()); +} + QRect QComboBoxPrivate::popupGeometry(int screen) const { return QStylePrivate::useFullScreenForPopup() @@ -2202,20 +2220,7 @@ void QComboBox::setModel(QAbstractItemModel *model) setRootModelIndex(QModelIndex()); - bool currentReset = false; - - const int rowCount = count(); - for (int pos=0; pos < rowCount; pos++) { - if (d->model->index(pos, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled) { - setCurrentIndex(pos); - currentReset = true; - break; - } - } - - if (!currentReset) - setCurrentIndex(-1); - + d->trySetValidIndex(); d->modelChanged(); } diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 7a3fcf6e0f..3e78e756a6 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -371,6 +371,7 @@ public: void _q_rowsRemoved(const QModelIndex &parent, int start, int end); void updateArrow(QStyle::StateFlag state); bool updateHoverControl(const QPoint &pos); + void trySetValidIndex(); QRect popupGeometry(int screen = -1) const; QStyle::SubControl newHoverControl(const QPoint &pos); int computeWidthHint() const; diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index ce08e3439a..f7a4f8e446 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -490,14 +490,14 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma if (focusRect.width() > visibleRect.width()) d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2); else if (focusRect.right() > visibleRect.right()) - d->hbar->setValue(focusRect.right() - d->viewport->width()); + d->hbar->setValue(focusRect.right() - d->viewport->width() + 1); else if (focusRect.left() < visibleRect.left()) d->hbar->setValue(focusRect.left()); if (focusRect.height() > visibleRect.height()) d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2); else if (focusRect.bottom() > visibleRect.bottom()) - d->vbar->setValue(focusRect.bottom() - d->viewport->height()); + d->vbar->setValue(focusRect.bottom() - d->viewport->height() + 1); else if (focusRect.top() < visibleRect.top()) d->vbar->setValue(focusRect.top()); } diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index 08428f673e..cbd600ec6c 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1168,11 +1168,11 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, } else { num = locale.toInt(copy, &ok); if (!ok && (max >= 1000 || min <= -1000)) { - const QChar sep = locale.groupSeparator(); - const QChar doubleSep[2] = {sep, sep}; - if (copy.contains(sep) && !copy.contains(QString(doubleSep, 2))) { + const QString sep(locale.groupSeparator()); + const QString doubleSep = sep + sep; + if (copy.contains(sep) && !copy.contains(doubleSep)) { QString copy2 = copy; - copy2.remove(locale.groupSeparator()); + copy2.remove(sep); num = locale.toInt(copy2, &ok); } } @@ -1314,6 +1314,10 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, const bool plus = max >= 0; const bool minus = min <= 0; + const QString group(locale.groupSeparator()); + const uint groupUcs = (group.size() > 1 && group.at(0).isHighSurrogate() + ? QChar::surrogateToUcs4(group.at(0), group.at(1)) + : group.at(0).unicode()); switch (len) { case 0: state = max != min ? QValidator::Intermediate : QValidator::Invalid; @@ -1360,14 +1364,15 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, } } } else { - const QChar last = copy.at(len - 1); - const QChar secondLast = copy.at(len - 2); - if ((last == locale.groupSeparator() || last.isSpace()) - && (secondLast == locale.groupSeparator() || secondLast.isSpace())) { + const QChar last = copy.back(); + const bool groupEnd = copy.endsWith(group); + const QStringView head(copy.constData(), groupEnd ? len - group.size() : len - 1); + const QChar secondLast = head.back(); + if ((groupEnd || last.isSpace()) && (head.endsWith(group) || secondLast.isSpace())) { state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; goto end; - } else if (last.isSpace() && (!locale.groupSeparator().isSpace() || secondLast.isSpace())) { + } else if (last.isSpace() && (!QChar::isSpace(groupUcs) || secondLast.isSpace())) { state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; goto end; @@ -1381,26 +1386,31 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok; if (!ok) { - if (locale.groupSeparator().isPrint()) { - if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) { + if (QChar::isPrint(groupUcs)) { + if (max < 1000 && min > -1000 && copy.contains(group)) { state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; goto end; } const int len = copy.size(); - for (int i=0; i<len- 1; ++i) { - if (copy.at(i) == locale.groupSeparator() && copy.at(i + 1) == locale.groupSeparator()) { - QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; - state = QValidator::Invalid; - goto end; + for (int i = 0; i < len - 1;) { + if (QStringView(copy).mid(i).startsWith(group)) { + if (QStringView(copy).mid(i + group.size()).startsWith(group)) { + QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; + state = QValidator::Invalid; + goto end; + } + i += group.size(); + } else { + i++; } } QString copy2 = copy; - copy2.remove(locale.groupSeparator()); + copy2.remove(group); num = locale.toDouble(copy2, &ok); - QSBDEBUG() << locale.groupSeparator() << num << copy2 << ok; + QSBDEBUG() << group << num << copy2 << ok; if (!ok) { state = QValidator::Invalid; diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 49a1a02867..3da7e365c8 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -992,12 +992,12 @@ void QWidgetTextControl::selectAll() void QWidgetTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset, QWidget *contextWidget) { - QMatrix m; - m.translate(coordinateOffset.x(), coordinateOffset.y()); - processEvent(e, m, contextWidget); + QTransform t; + t.translate(coordinateOffset.x(), coordinateOffset.y()); + processEvent(e, t, contextWidget); } -void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget) +void QWidgetTextControl::processEvent(QEvent *e, const QTransform &transform, QWidget *contextWidget) { Q_D(QWidgetTextControl); if (d->interactionFlags == Qt::NoTextInteraction) { @@ -1038,22 +1038,22 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget break; case QEvent::MouseButtonPress: { QMouseEvent *ev = static_cast<QMouseEvent *>(e); - d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mousePressEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::MouseMove: { QMouseEvent *ev = static_cast<QMouseEvent *>(e); - d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mouseMoveEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::MouseButtonRelease: { QMouseEvent *ev = static_cast<QMouseEvent *>(e); - d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::MouseButtonDblClick: { QMouseEvent *ev = static_cast<QMouseEvent *>(e); - d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::InputMethod: @@ -1062,7 +1062,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget #ifndef QT_NO_CONTEXTMENU case QEvent::ContextMenu: { QContextMenuEvent *ev = static_cast<QContextMenuEvent *>(e); - d->contextMenuEvent(ev->globalPos(), matrix.map(ev->pos()), contextWidget); + d->contextMenuEvent(ev->globalPos(), transform.map(ev->pos()), contextWidget); break; } #endif // QT_NO_CONTEXTMENU case QEvent::FocusIn: @@ -1077,7 +1077,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget #ifndef QT_NO_TOOLTIP case QEvent::ToolTip: { QHelpEvent *ev = static_cast<QHelpEvent *>(e); - d->showToolTip(ev->globalPos(), matrix.map(ev->pos()), contextWidget); + d->showToolTip(ev->globalPos(), transform.map(ev->pos()), contextWidget); break; } #endif // QT_NO_TOOLTIP @@ -1094,13 +1094,13 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget break; case QEvent::DragMove: { QDragMoveEvent *ev = static_cast<QDragMoveEvent *>(e); - if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) + if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->pos()))) ev->acceptProposedAction(); break; } case QEvent::Drop: { QDropEvent *ev = static_cast<QDropEvent *>(e); - if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) + if (d->dropEvent(ev->mimeData(), transform.map(ev->pos()), ev->dropAction(), ev->source())) ev->acceptProposedAction(); break; } @@ -1109,32 +1109,32 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget #if QT_CONFIG(graphicsview) case QEvent::GraphicsSceneMousePress: { QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); - d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mousePressEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneMouseMove: { QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); - d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mouseMoveEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneMouseRelease: { QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); - d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneMouseDoubleClick: { QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); - d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneContextMenu: { QGraphicsSceneContextMenuEvent *ev = static_cast<QGraphicsSceneContextMenuEvent *>(e); - d->contextMenuEvent(ev->screenPos(), matrix.map(ev->pos()), contextWidget); + d->contextMenuEvent(ev->screenPos(), transform.map(ev->pos()), contextWidget); break; } case QEvent::GraphicsSceneHoverMove: { QGraphicsSceneHoverEvent *ev = static_cast<QGraphicsSceneHoverEvent *>(e); - d->mouseMoveEvent(ev, Qt::NoButton, matrix.map(ev->pos()), ev->modifiers(),Qt::NoButton, + d->mouseMoveEvent(ev, Qt::NoButton, transform.map(ev->pos()), ev->modifiers(),Qt::NoButton, ev->screenPos()); break; } @@ -1148,12 +1148,12 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget break; case QEvent::GraphicsSceneDragMove: { QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e); - if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) + if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->pos()))) ev->acceptProposedAction(); break; } case QEvent::GraphicsSceneDrop: { QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e); - if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) + if (d->dropEvent(ev->mimeData(), transform.map(ev->pos()), ev->dropAction(), ev->source())) ev->accept(); break; } #endif // QT_CONFIG(graphicsview) diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h index 1f06aa0b97..c445ecaf80 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p.h @@ -252,7 +252,7 @@ public: QPalette palette() const; void setPalette(const QPalette &pal); - virtual void processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget = nullptr); + virtual void processEvent(QEvent *e, const QTransform &transform, QWidget *contextWidget = nullptr); void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF(), QWidget *contextWidget = nullptr); // control methods |