diff options
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsview.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 57be850829..7589a1ebbd 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -348,22 +348,21 @@ QGraphicsViewPrivate::QGraphicsViewPrivate() hasUpdateClip(false), mousePressButton(Qt::NoButton), leftIndent(0), topIndent(0), - lastMouseEvent(QEvent::None, QPointF(), QPointF(), QPointF(), Qt::NoButton, 0, 0), + lastMouseEvent(QEvent::None, QPointF(), QPointF(), QPointF(), Qt::NoButton, { }, { }), alignment(Qt::AlignCenter), transformationAnchor(QGraphicsView::AnchorViewCenter), resizeAnchor(QGraphicsView::NoAnchor), viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), - optimizationFlags(0), - scene(0), + scene(nullptr), #if QT_CONFIG(rubberband) rubberBanding(false), rubberBandSelectionMode(Qt::IntersectsItemShape), rubberBandSelectionOperation(Qt::ReplaceSelection), #endif - handScrollMotions(0), cacheMode(0), + handScrollMotions(0), #ifndef QT_NO_CURSOR hasStoredOriginalCursor(false), #endif - lastDragDropEvent(0), + lastDragDropEvent(nullptr), updateSceneSlotReimplementedChecked(false) { styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS); @@ -385,7 +384,7 @@ void QGraphicsViewPrivate::recalculateContentSize() int height = maxSize.height(); QRectF viewRect = matrix.mapRect(q->sceneRect()); - bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)); + bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q)); if (frameOnlyAround) { if (hbarpolicy == Qt::ScrollBarAlwaysOn) height -= frameWidth * 2; @@ -395,7 +394,7 @@ void QGraphicsViewPrivate::recalculateContentSize() // Adjust the maximum width and height of the viewport based on the width // of visible scroll bars. - int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q); + int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, q); if (frameOnlyAround) scrollBarExtent += frameWidth * 2; @@ -1163,19 +1162,19 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg void QGraphicsViewPrivate::updateInputMethodSensitivity() { Q_Q(QGraphicsView); - QGraphicsItem *focusItem = 0; + QGraphicsItem *focusItem = nullptr; bool enabled = scene && (focusItem = scene->focusItem()) && (focusItem->d_ptr->flags & QGraphicsItem::ItemAcceptsInputMethod); q->setAttribute(Qt::WA_InputMethodEnabled, enabled); q->viewport()->setAttribute(Qt::WA_InputMethodEnabled, enabled); if (!enabled) { - q->setInputMethodHints(0); + q->setInputMethodHints({ }); return; } QGraphicsProxyWidget *proxy = focusItem->d_ptr->isWidget && focusItem->d_ptr->isProxyWidget() - ? static_cast<QGraphicsProxyWidget *>(focusItem) : 0; + ? static_cast<QGraphicsProxyWidget *>(focusItem) : nullptr; if (!proxy) { q->setInputMethodHints(focusItem->inputMethodHints()); } else if (QWidget *widget = proxy->widget()) { @@ -1183,7 +1182,7 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity() widget = fw; q->setInputMethodHints(widget->inputMethodHints()); } else { - q->setInputMethodHints(0); + q->setInputMethodHints({ }); } } @@ -1193,7 +1192,7 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity() QGraphicsView::QGraphicsView(QWidget *parent) : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) { - setViewport(0); + setViewport(nullptr); setAcceptDrops(true); setBackgroundRole(QPalette::Base); // Investigate leaving these disabled by default. @@ -1209,7 +1208,7 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) { setScene(scene); - setViewport(0); + setViewport(nullptr); setAcceptDrops(true); setBackgroundRole(QPalette::Base); // Investigate leaving these disabled by default. @@ -1223,7 +1222,7 @@ QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) QGraphicsView::QGraphicsView(QGraphicsViewPrivate &dd, QWidget *parent) : QAbstractScrollArea(dd, parent) { - setViewport(0); + setViewport(nullptr); setAcceptDrops(true); setBackgroundRole(QPalette::Base); // Investigate leaving these disabled by default. @@ -2375,7 +2374,7 @@ QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const { Q_D(const QGraphicsView); if (!d->scene) - return 0; + return nullptr; const QList<QGraphicsItem *> itemsAtPos = items(pos); return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first(); } @@ -2889,7 +2888,7 @@ bool QGraphicsView::viewportEvent(QEvent *event) } d->useLastMouseEvent = false; // a hack to pass a viewport pointer to the scene inside the leave event - Q_ASSERT(event->d == 0); + Q_ASSERT(event->d == nullptr); QScopedValueRollback<QEventPrivate *> rb(event->d); event->d = reinterpret_cast<QEventPrivate *>(viewport()); QCoreApplication::sendEvent(d->scene, event); @@ -3020,7 +3019,7 @@ void QGraphicsView::dropEvent(QDropEvent *event) event->setDropAction(sceneEvent.dropAction()); delete d->lastDragDropEvent; - d->lastDragDropEvent = 0; + d->lastDragDropEvent = nullptr; } /*! @@ -3078,7 +3077,7 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) sceneEvent.setWidget(d->lastDragDropEvent->widget()); sceneEvent.setSource(d->lastDragDropEvent->source()); delete d->lastDragDropEvent; - d->lastDragDropEvent = 0; + d->lastDragDropEvent = nullptr; // Send it to the scene. QCoreApplication::sendEvent(d->scene, &sceneEvent); @@ -3526,7 +3525,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) d->scene->d_func()->rectAdjust = 1; else d->scene->d_func()->rectAdjust = 2; - d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : 0, + d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : nullptr, &d->exposedRegion, viewport()); d->scene->d_func()->rectAdjust = oldRectAdjust; // Make sure the painter's world transform is restored correctly when @@ -3795,7 +3794,7 @@ void QGraphicsView::drawItems(QPainter *painter, int numItems, { Q_D(QGraphicsView); if (d->scene) { - QWidget *widget = painter->device() == viewport() ? viewport() : 0; + QWidget *widget = painter->device() == viewport() ? viewport() : nullptr; d->scene->drawItems(painter, numItems, items, options, widget); } } |