diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:16:29 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:23:19 +0200 |
commit | f4b4c4f79b629498f3cddbbc10df8c1b4d6020d9 (patch) | |
tree | 4119707660438ff58bd51f9cbe0f9e2a33f4b806 /src/widgets/graphicsview | |
parent | 9bd6cec74dbbc5aece55dc0c8808494db29b9963 (diff) | |
parent | 93f2f33a49f6c96a4f94f344edf03164ed944d02 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I3a1d7673c3c20019ab12a2ea0a60f1619920a34c
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/graphicsview.pri | 7 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 15 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.h | 6 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsproxywidget.cpp | 12 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 15 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 12 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview_p.h | 22 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget.cpp | 16 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget_p.cpp | 7 |
9 files changed, 24 insertions, 88 deletions
diff --git a/src/widgets/graphicsview/graphicsview.pri b/src/widgets/graphicsview/graphicsview.pri index 7d10244634..d69a6f5c3f 100644 --- a/src/widgets/graphicsview/graphicsview.pri +++ b/src/widgets/graphicsview/graphicsview.pri @@ -4,7 +4,6 @@ qtConfig(graphicsview) { HEADERS += graphicsview/qgraphicsgridlayout.h \ graphicsview/qgraphicsitem.h \ graphicsview/qgraphicsitem_p.h \ - graphicsview/qgraphicsitemanimation.h \ graphicsview/qgraphicslayout.h \ graphicsview/qgraphicslayout_p.h \ graphicsview/qgraphicslayoutitem.h \ @@ -34,7 +33,6 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \ SOURCES += graphicsview/qgraphicsgridlayout.cpp \ graphicsview/qgraphicsitem.cpp \ - graphicsview/qgraphicsitemanimation.cpp \ graphicsview/qgraphicslayout.cpp \ graphicsview/qgraphicslayout_p.cpp \ graphicsview/qgraphicslayoutitem.cpp \ @@ -55,4 +53,9 @@ SOURCES += graphicsview/qgraphicsgridlayout.cpp \ graphicsview/qsimplex_p.cpp \ graphicsview/qgraphicsanchorlayout_p.cpp \ graphicsview/qgraphicsanchorlayout.cpp + + qtConfig(easingcurve) { + HEADERS += graphicsview/qgraphicsitemanimation.h + SOURCES += graphicsview/qgraphicsitemanimation.cpp + } } diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index ca30c72db5..bb00db4c01 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -7566,19 +7566,6 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints) */ void QGraphicsItem::updateMicroFocus() { -#if !defined(QT_NO_IM) && 0 /* Used to be included in Qt4 for Q_WS_X11 */ - if (QWidget *fw = QApplication::focusWidget()) { - if (scene()) { - for (int i = 0 ; i < scene()->views().count() ; ++i) { - if (scene()->views().at(i) == fw) { - if (qApp) - QGuiApplication::inputMethod()->update(Qt::ImQueryAll); - break; - } - } - } - } -#endif } /*! @@ -11536,9 +11523,11 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change) case QGraphicsItem::ItemFlagsHaveChanged: str = "ItemFlagsHaveChanged"; break; +#if QT_DEPRECATED_SINCE(5, 14) case QGraphicsItem::ItemMatrixChange: str = "ItemMatrixChange"; break; +#endif case QGraphicsItem::ItemParentChange: str = "ItemParentChange"; break; diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index 7dd4441ae9..d66a4917e5 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -110,8 +110,10 @@ public: enum GraphicsItemChange { ItemPositionChange, - ItemMatrixChange, - ItemVisibleChange, +#if QT_DEPRECATED_SINCE(5, 14) + ItemMatrixChange Q_DECL_ENUMERATOR_DEPRECATED_X("Use ItemTransformChange instead"), +#endif + ItemVisibleChange = 2, ItemEnabledChange, ItemSelectedChange, ItemParentChange, diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 2b6712075f..7413a26261 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -404,7 +404,7 @@ void QGraphicsProxyWidgetPrivate::_q_removeWidgetSlot() { Q_Q(QGraphicsProxyWidget); if (!widget.isNull()) { - if (QWExtra *extra = widget->d_func()->extra) + if (const auto &extra = widget->d_func()->extra) extra->proxyWidget = 0; } widget = 0; @@ -477,8 +477,8 @@ void QGraphicsProxyWidgetPrivate::updateProxyInputMethodAcceptanceFromWidget() */ void QGraphicsProxyWidgetPrivate::embedSubWindow(QWidget *subWin) { - QWExtra *extra; - if (!((extra = subWin->d_func()->extra) && extra->proxyWidget)) { + const auto &extra = subWin->d_func()->extra; + if (!extra || !extra->proxyWidget) { QGraphicsProxyWidget *subProxy = new QGraphicsProxyWidget(q_func(), subWin->windowFlags()); subProxy->d_func()->setWidget_helper(subWin, false); } @@ -631,7 +631,7 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto if (!newWidget) return; if (!newWidget->isWindow()) { - QWExtra *extra = newWidget->parentWidget()->d_func()->extra; + const auto &extra = newWidget->parentWidget()->d_func()->extra; if (!extra || !extra->proxyWidget) { qWarning("QGraphicsProxyWidget::setWidget: cannot embed widget %p " "which is not a toplevel widget, and is not a child of an embedded widget", newWidget); @@ -641,10 +641,10 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto // Register this proxy within the widget's private. // ### This is a bit backdoorish - QWExtra *extra = newWidget->d_func()->extra; + QWExtra *extra = newWidget->d_func()->extra.get(); if (!extra) { newWidget->d_func()->createExtra(); - extra = newWidget->d_func()->extra; + extra = newWidget->d_func()->extra.get(); } QGraphicsProxyWidget **proxyWidget = &extra->proxyWidget; if (*proxyWidget) { diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 313939e638..1208adfd17 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4170,14 +4170,6 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) wheelEvent->scenePos(), wheelEvent->widget()); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - // On Mac, ignore the event if the first item under the mouse is not the last opened - // popup (or one of its descendant) - if (!d->popupWidgets.isEmpty() && !wheelCandidates.isEmpty() && wheelCandidates.first() != d->popupWidgets.back() && !d->popupWidgets.back()->isAncestorOf(wheelCandidates.first())) { - wheelEvent->accept(); - return; - } -#else // Find the first popup under the mouse (including the popup's descendants) starting from the last. // Remove all popups after the one found, or all or them if no popup is under the mouse. // Then continue with the event. @@ -4187,7 +4179,6 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) break; d->removePopup(*iter); } -#endif bool hasSetFocus = false; for (QGraphicsItem *item : wheelCandidates) { @@ -4409,11 +4400,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte QGraphicsItem::CacheMode cacheMode = QGraphicsItem::CacheMode(itemd->cacheMode); // Render directly, using no cache. - if (cacheMode == QGraphicsItem::NoCache -#if 0 // Used to be included in Qt4 for Q_WS_X11 - || !X11->use_xrender -#endif - ) { + if (cacheMode == QGraphicsItem::NoCache) { _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, true, painterStateProtection); return; } diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 7f14218720..57be850829 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -3476,11 +3476,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) const QTransform viewTransform = painter.worldTransform(); // Draw background - if ((d->cacheMode & CacheBackground) -#if 0 // Used to be included in Qt4 for Q_WS_X11 - && X11->use_xrender -#endif - ) { + if (d->cacheMode & CacheBackground) { // Recreate the background pixmap, and flag the whole background as // exposed. if (d->mustResizeBackgroundPixmap) { @@ -3677,11 +3673,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy) d->updateLastCenterPoint(); - if ((d->cacheMode & CacheBackground) -#if 0 // Used to be included in Qt4 for Q_WS_X11 - && X11->use_xrender -#endif - ) { + if (d->cacheMode & CacheBackground) { // Below, QPixmap::scroll() works in device pixels, while the delta values // and backgroundPixmapExposed are in device independent pixels. const qreal dpr = d->backgroundPixmap.devicePixelRatio(); diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h index 0428b9ce70..01af61d6ba 100644 --- a/src/widgets/graphicsview/qgraphicsview_p.h +++ b/src/widgets/graphicsview/qgraphicsview_p.h @@ -184,24 +184,10 @@ public: inline void dispatchPendingUpdateRequests() { -#if 0 // Used to be included in Qt4 for Q_WS_MAC - // QWidget::update() works slightly different on the Mac without the raster engine; - // it's not part of our backing store so it needs special threatment. - if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) { - // At this point either HIViewSetNeedsDisplay (Carbon) or setNeedsDisplay: YES (Cocoa) - // is called, which means there's a pending update request. We want to dispatch it - // now because otherwise graphics view updates would require two - // round-trips in the event loop before the item is painted. - extern void qt_mac_dispatchPendingUpdateRequests(QWidget *); - qt_mac_dispatchPendingUpdateRequests(viewport->window()); - } else -#endif - { - if (qt_widget_private(viewport)->paintOnScreen()) - QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest); - else - QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); - } + if (qt_widget_private(viewport)->shouldPaintOnScreen()) + QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest); + else + QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); } void setUpdateClip(QGraphicsItem *); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 643f073085..cf041b9817 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -716,22 +716,6 @@ void QGraphicsWidget::initStyleOption(QStyleOption *option) const option->state |= QStyle::State_Window; /* ### -#if 0 // Used to be included in Qt4 for Q_WS_MAC - extern bool qt_mac_can_clickThrough(const QGraphicsWidget *w); //qwidget_mac.cpp - if (!(option->state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget)) - option->state &= ~QStyle::State_Enabled; - - switch (QMacStyle::widgetSizePolicy(widget)) { - case QMacStyle::SizeSmall: - option->state |= QStyle::State_Small; - break; - case QMacStyle::SizeMini: - option->state |= QStyle::State_Mini; - break; - default: - ; - } -#endif #ifdef QT_KEYPAD_NAVIGATION if (widget->hasEditFocus()) state |= QStyle::State_HasEditFocus; diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index fd47f444ea..0156faf8e4 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -691,13 +691,6 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent case Qt::TitleBarArea: windowData->buttonRect = q->style()->subControlRect( QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - // On mac we should hover if we are in the 'area' of the buttons - windowData->buttonRect |= q->style()->subControlRect( - QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMinButton, 0); - windowData->buttonRect |= q->style()->subControlRect( - QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMaxButton, 0); -#endif if (windowData->buttonRect.contains(pos.toPoint())) windowData->buttonMouseOver = true; event->ignore(); |