257#include <QtCore/qdatetime.h>
258#include <QtCore/qdebug.h>
259#include <QtCore/qmath.h>
260#include <QtCore/qscopedvaluerollback.h>
261#include <QtWidgets/qapplication.h>
262#include <QtGui/qevent.h>
263#include <QtWidgets/qlayout.h>
264#include <QtGui/qtransform.h>
265#include <QtGui/qpainter.h>
266#include <QtGui/qpainterpath.h>
267#include <QtWidgets/qscrollbar.h>
268#include <QtWidgets/qstyleoption.h>
270#include <private/qevent_p.h>
271#include <QtGui/private/qeventpoint_p.h>
281 else if (
d >= (
qreal) INT_MAX)
283 return d >= 0.0 ? int(
d + 0.5) : int(
d -
int(
d-1) + 0.5) + int(
d-1);
288 for (
int i = 0;
i < touchEvent->pointCount(); ++
i) {
289 auto &pt = touchEvent->
point(
i);
292 QMutableEventPoint::setScenePosition(pt,
d->mapToScene(pt.position()));
301 : renderHints(
QPainter::TextAntialiasing),
303 sceneInteractionAllowed(true), hasSceneRect(
false),
304 connectedToScene(
false),
305 useLastMouseEvent(
false),
306 identityMatrix(true),
308 accelerateScrolling(true),
309 keepLastCenterPoint(true),
311 handScrolling(
false),
312 mustAllocateStyleOptions(
false),
313 mustResizeBackgroundPixmap(true),
314 fullUpdatePending(true),
315 hasUpdateClip(
false),
316 mousePressButton(
Qt::NoButton),
317 leftIndent(0), topIndent(0),
323 rubberBanding(
false),
324 rubberBandSelectionMode(
Qt::IntersectsItemShape),
325 rubberBandSelectionOperation(
Qt::ReplaceSelection),
327 handScrollMotions(0),
329 hasStoredOriginalCursor(
false),
332 updateSceneSlotReimplementedChecked(
false)
348 const QSize maxSize =
q->maximumViewportSize();
354 if (frameOnlyAround) {
358 width -= frameWidth * 2;
364 + (frameOnlyAround ? frameWidth * 2 : 0);
372 useVerticalScrollBar =
true;
375 if (viewRect.
width() >
width - scrollBarExtent)
376 useHorizontalScrollBar =
true;
378 if (useHorizontalScrollBar)
379 height -= scrollBarExtent;
380 if (useVerticalScrollBar)
381 width -= scrollBarExtent;
410 hbar->setRange(0, 0);
415 hbar->setPageStep(
width);
416 hbar->setSingleStep(
width / 20);
418 if (oldLeftIndent != 0)
419 hbar->setValue(-oldLeftIndent);
440 vbar->setRange(0, 0);
445 vbar->setPageStep(
height);
446 vbar->setSingleStep(
height / 20);
448 if (oldTopIndent != 0)
449 vbar->setValue(-oldTopIndent);
483 if (
q->underMouse()) {
570 if (
q->isRightToLeft()) {
602 return QAbstractScrollAreaPrivate::canStartScrollingAt(startPos);
629#if QT_CONFIG(rubberband)
630 updateRubberBand(
event);
660 if (
event->spontaneous())
679 if (
scene->d_func()->allItemsIgnoreHoverEvents && !
scene->d_func()->allItemsUseDefaultCursor
680 &&
scene->d_func()->cachedItemsUnderMouse.isEmpty()) {
681 scene->d_func()->cachedItemsUnderMouse =
scene->d_func()->itemsAtPosition(mouseEvent.
screenPos(),
705#if QT_CONFIG(rubberband)
709 QStyleOptionRubberBand
option;
716 tmp +=
rect.adjusted(-1, -1, 1, 1);
734 q->viewport()->update(rubberBandRegion(
q->viewport(), rubberBandRect));
741 if (!
event->buttons()) {
742 rubberBanding =
false;
744 if (!rubberBandRect.isNull()) {
745 rubberBandRect =
QRect();
751 QRect oldRubberband = rubberBandRect;
755 const QPoint ep =
event->position().toPoint();
761 oldRubberband = rubberBandRect;
768 q->viewport()->update(rubberBandRegion(
q->viewport(), rubberBandRect));
774 selectionArea.
addPolygon(
q->mapToScene(rubberBandRect));
777 scene->
setSelectionArea(selectionArea, rubberBandSelectionOperation, rubberBandSelectionMode,
q->viewportTransform());
780void QGraphicsViewPrivate::clearRubberBand()
788 q->viewport()->update(rubberBandRegion(
q->viewport(), rubberBandRect));
793 rubberBanding =
false;
795 if (!rubberBandRect.isNull()) {
796 rubberBandRect =
QRect();
868#if QT_CONFIG(draganddrop)
910 }
while ((parentItem = itemd->
parent));
926 return r.toAlignedRect();
964{
return !(
r.left() >
width) && !(
r.right() < 0) && !(
r.top() >=
height) && !(
r.bottom() < 0); }
967{
return r.left() <= 0 &&
r.top() <= 0 &&
r.right() >=
width - 1 &&
r.bottom() >=
height - 1; }
971 if (
rect->isEmpty()) {
1007 clip =
r.toAlignedRect();
1008 }
else if (!
q->isTransformed()) {
1012 xform *=
q->viewportTransform();
1041 if (dontAdjustForAntialiasing)
1042 viewRect.
adjust(-1, -1, 1, 1);
1044 viewRect.
adjust(-2, -2, 2, 2);
1048 for (
QRect viewRect : region) {
1049 if (dontAdjustForAntialiasing)
1050 viewRect.
adjust(-1, -1, 1, 1);
1052 viewRect.
adjust(-2, -2, 2, 2);
1153 if (simpleRectLookup) {
1154 return scene->
items(exposedRegionSceneBounds,
1164 adjustedRegion +=
r.adjusted(-1, -1, 1, 1);
1188 q->setInputMethodHints({ });
1201 q->setInputMethodHints({ });
1211 setViewport(
nullptr);
1212 setAcceptDrops(
true);
1227 setViewport(
nullptr);
1228 setAcceptDrops(
true);
1239 : QAbstractScrollArea(dd,
parent)
1241 setViewport(
nullptr);
1242 setAcceptDrops(
true);
1256 d->scene->d_func()->views.removeAll(
this);
1257 delete d->lastDragDropEvent;
1268 baseSize +=
QSizeF(
d->frameWidth * 2,
d->frameWidth * 2);
1271 return QAbstractScrollArea::sizeHint();
1292 return d->renderHints;
1297 if (hints ==
d->renderHints)
1299 d->renderHints = hints;
1312 QPainter::RenderHints oldHints =
d->renderHints;
1314 if (oldHints !=
d->renderHints)
1333 return d->alignment;
1340 d->recalculateContentSize();
1365 return d->transformationAnchor;
1370 d->transformationAnchor = anchor;
1375 d->viewport->setMouseTracking(
true);
1397 return d->resizeAnchor;
1402 d->resizeAnchor = anchor;
1407 d->viewport->setMouseTracking(
true);
1431 return d->viewportUpdateMode;
1436 d->viewportUpdateMode =
mode;
1460 return d->optimizationFlags;
1465 d->optimizationFlags =
flags;
1476 d->optimizationFlags.setFlag(flag,
enabled);
1501 if (
d->dragMode ==
mode)
1504#if QT_CONFIG(rubberband)
1505 d->clearRubberBand();
1518 d->handScrolling =
false;
1525 d->hasStoredOriginalCursor =
false;
1531#if QT_CONFIG(rubberband)
1548 return d->rubberBandSelectionMode;
1553 d->rubberBandSelectionMode =
mode;
1568QRect QGraphicsView::rubberBandRect()
const
1574 return d->rubberBandRect;
1601 return d->cacheMode;
1606 if (
mode ==
d->cacheMode)
1608 d->cacheMode =
mode;
1633 d->mustResizeBackgroundPixmap =
true;
1635 }
else if (
d->mustResizeBackgroundPixmap) {
1638 d->mustResizeBackgroundPixmap =
false;
1640 d->backgroundPixmapExposed =
QRegion();
1668 d->backgroundPixmapExposed += viewRect;
1670 d->scene->update(
rect);
1688 return d->sceneInteractionAllowed;
1693 d->sceneInteractionAllowed = allowed;
1733 d->scene->d_func()->removeView(
this);
1734 d->connectedToScene =
false;
1741 d->scene->clearFocus();
1745 if ((
d->scene =
scene)) {
1748 d->updateSceneSlotReimplementedChecked =
false;
1749 d->scene->d_func()->addView(
this);
1750 d->recalculateContentSize();
1752 d->keepLastCenterPoint =
true;
1755 if (!
d->scene->d_func()->allItemsIgnoreHoverEvents
1756 || !
d->scene->d_func()->allItemsUseDefaultCursor) {
1757 d->viewport->setMouseTracking(
true);
1761 if (!
d->scene->d_func()->allItemsIgnoreTouchEvents)
1769 d->recalculateContentSize();
1772 d->updateInputMethodSensitivity();
1774 if (
d->scene && hasFocus())
1775 d->scene->setFocus();
1804 if (
d->hasSceneRect)
1805 return d->sceneRect;
1807 return d->scene->sceneRect();
1813 d->hasSceneRect = !
rect.isNull();
1814 d->sceneRect =
rect;
1815 d->recalculateContentSize();
1866 matrix.translate(dx, dy);
1890 if (!
d->leftIndent) {
1891 if (isRightToLeft()) {
1893 horizontal += horizontalScrollBar()->minimum();
1894 horizontal += horizontalScrollBar()->maximum();
1895 horizontal -= int(viewPoint.
x() -
width / 2.0);
1896 horizontalScrollBar()->setValue(horizontal);
1898 horizontalScrollBar()->setValue(
int(viewPoint.
x() -
width / 2.0));
1902 verticalScrollBar()->setValue(
int(viewPoint.
y() -
height / 2.0));
1903 d->lastCenterPoint = oldCenterPoint;
1948 if (viewRect.
left() <=
left + xmargin) {
1951 horizontalScrollBar()->setValue(
int(viewRect.
left() - xmargin - 0.5));
1956 horizontalScrollBar()->setValue(
int(viewRect.
right() -
width + xmargin + 0.5));
1958 if (viewRect.
top() <=
top + ymargin) {
1961 verticalScrollBar()->setValue(
int(viewRect.
top() - ymargin - 0.5));
1966 verticalScrollBar()->setValue(
int(viewRect.
bottom() -
height + ymargin + 0.5));
2021 if (!
d->scene ||
rect.isNull())
2032 QRectF viewRect =
viewport()->rect().adjusted(margin, margin, -margin, -margin);
2042 switch (aspectRatioMode) {
2044 xratio = yratio =
qMin(xratio, yratio);
2047 xratio = yratio =
qMax(xratio, yratio);
2054 scale(xratio, yratio);
2127 targetRect = sourceRect;
2137 switch (aspectRatioMode) {
2139 xratio = yratio =
qMin(xratio, yratio);
2142 xratio = yratio =
qMax(xratio, yratio);
2154 int numItems = itemList.
size();
2155 for (
int i = 0;
i < numItems; ++
i)
2156 itemArray[numItems -
i - 1] = itemList.
at(
i);
2161 QTransform painterMatrix =
d->matrix * moveMatrix;
2164 .
scale(xratio, yratio)
2169 for (
int i = 0;
i < numItems; ++
i)
2170 itemArray[
i]->d_ptr->initStyleOption(&styleOptionArray[
i], painterMatrix, targetRect.
toRect());
2177 path.addPolygon(sourceScenePoly);
2178 path.closeSubpath();
2190 delete [] itemArray;
2191 d->freeStyleOptionsArray(styleOptionArray);
2208 return d->scene->items();
2370 p.
rx() +=
d->horizontalScroll();
2371 p.ry() +=
d->verticalScroll();
2372 return d->identityMatrix ?
p :
d->matrix.inverted().map(
p);
2391 if (!
rect.isValid())
2394 QPointF scrollOffset(
d->horizontalScroll(),
d->verticalScroll());
2396 QPointF tl = scrollOffset +
r.topLeft();
2398 QPointF br = scrollOffset +
r.bottomRight();
2399 QPointF bl = scrollOffset +
r.bottomLeft();
2402 if (!
d->identityMatrix) {
2404 poly[0] =
x.map(tl);
2405 poly[1] =
x.map(
tr);
2406 poly[2] =
x.map(br);
2407 poly[3] =
x.map(bl);
2449 matrix *=
d->matrix.inverted();
2461 QPointF p =
d->identityMatrix ? point :
d->matrix.map(point);
2462 p.rx() -=
d->horizontalScroll();
2463 p.ry() -=
d->verticalScroll();
2487 if (!
d->identityMatrix) {
2489 tl =
x.map(
rect.topLeft());
2491 br =
x.map(
rect.bottomRight());
2492 bl =
x.map(
rect.bottomLeft());
2494 tl =
rect.topLeft();
2496 br =
rect.bottomRight();
2497 bl =
rect.bottomLeft();
2499 QPointF scrollOffset(
d->horizontalScroll(),
d->verticalScroll());
2507 poly[1] =
tr.toPoint();
2559 if (
value.userType() == QMetaType::QRectF)
2561 else if (
value.userType() == QMetaType::QPointF)
2563 else if (
value.userType() == QMetaType::QRect)
2564 value =
d->mapRectFromScene(
value.toRect()).toRect();
2565 else if (
value.userType() == QMetaType::QPoint)
2586 return d->backgroundBrush;
2591 d->backgroundBrush =
brush;
2596 d->mustResizeBackgroundPixmap =
true;
2616 return d->foregroundBrush;
2621 d->foregroundBrush =
brush;
2643 dirtyViewportRects.
reserve(
d->dirtyRegion.rectCount() + rects.
size());
2644 for (
const QRect &dirtyRect :
d->dirtyRegion)
2645 dirtyViewportRects += dirtyRect;
2647 d->dirtyBoundingRect =
QRect();
2657 bool redraw =
false;
2664 xrect.
adjust(-2, -2, 2, 2);
2666 xrect.
adjust(-1, -1, 1, 1);
2669 dirtyViewportRects << xrect;
2672 for (
const QRect &
rect : std::as_const(dirtyViewportRects)) {
2675 if (!boundingRectUpdate) {
2676 updateRegion +=
rect;
2693 else if (boundingRectUpdate)
2709 if (!
d->hasSceneRect) {
2710 d->sceneRect =
rect;
2711 d->recalculateContentSize();
2727 qWarning(
"QGraphicsView::setupViewport: cannot initialize null widget");
2733 d->accelerateScrolling = !(isGLWidget);
2748 if ((
d->scene && (!
d->scene->d_func()->allItemsIgnoreHoverEvents
2749 || !
d->scene->d_func()->allItemsUseDefaultCursor))
2756 if (
d->scene && !
d->scene->d_func()->allItemsIgnoreTouchEvents)
2759#ifndef QT_NO_GESTURES
2761 const auto gestures =
d->scene->d_func()->grabbedGestures.keys();
2777 if (
d->sceneInteractionAllowed) {
2778 switch (
event->type()) {
2794 if (
event->isAccepted())
2808 return QAbstractScrollArea::event(
event);
2818 return QAbstractScrollArea::viewportEvent(
event);
2820 switch (
event->type()) {
2832 if (!
d->scene->d_func()->popupWidgets.isEmpty())
2833 d->scene->d_func()->removePopup(
d->scene->d_func()->popupWidgets.constFirst());
2837 if (
d->scene && isActiveWindow()) {
2844 if (!
event->spontaneous() &&
d->scene && isActiveWindow()) {
2856 if (!
d->scene->d_func()->popupWidgets.isEmpty())
2857 d->scene->d_func()->removePopup(
d->scene->d_func()->popupWidgets.constFirst());
2859 d->useLastMouseEvent =
false;
2866#if QT_CONFIG(tooltip)
2880 d->fullUpdatePending =
false;
2881 d->dirtyScrollOffset =
QPoint();
2886 if (!
d->updateSceneSlotReimplementedChecked) {
2887 d->updateSceneSlotReimplementedChecked =
true;
2889 if (
mo != &QGraphicsView::staticMetaObject) {
2890 if (
mo->indexOfSlot(
"updateScene(QList<QRectF>)")
2891 != QGraphicsView::staticMetaObject.indexOfSlot(
"updateScene(QList<QRectF>)")) {
2906 if (
d->scene &&
d->sceneInteractionAllowed) {
2918#ifndef QT_NO_GESTURES
2925 if (
d->scene &&
d->sceneInteractionAllowed) {
2937 return QAbstractScrollArea::viewportEvent(
event);
2940#ifndef QT_NO_CONTEXTMENU
2947 if (!
d->scene || !
d->sceneInteractionAllowed)
2950 d->mousePressViewPoint =
event->pos();
2951 d->mousePressScenePoint =
mapToScene(
d->mousePressViewPoint);
2952 d->mousePressScreenPoint =
event->globalPos();
2953 d->lastMouseMoveScenePoint =
d->mousePressScenePoint;
2954 d->lastMouseMoveScreenPoint =
d->mousePressScreenPoint;
2965 event->setAccepted(contextEvent.
isAccepted());
2969#if QT_CONFIG(draganddrop)
2973void QGraphicsView::dropEvent(QDropEvent *
event)
2976 if (!
d->scene || !
d->sceneInteractionAllowed)
2981 d->populateSceneDragDropEvent(&sceneEvent,
event);
2987 event->setAccepted(sceneEvent.isAccepted());
2988 if (sceneEvent.isAccepted())
2989 event->setDropAction(sceneEvent.dropAction());
2991 delete d->lastDragDropEvent;
2992 d->lastDragDropEvent =
nullptr;
2998void QGraphicsView::dragEnterEvent(QDragEnterEvent *
event)
3001 if (!
d->scene || !
d->sceneInteractionAllowed)
3005 d->useLastMouseEvent =
false;
3009 d->populateSceneDragDropEvent(&sceneEvent,
event);
3012 d->storeDragDropEvent(&sceneEvent);
3018 if (sceneEvent.isAccepted()) {
3019 event->setAccepted(
true);
3020 event->setDropAction(sceneEvent.dropAction());
3027void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *
event)
3030 if (!
d->scene || !
d->sceneInteractionAllowed)
3032 if (!
d->lastDragDropEvent) {
3033 qWarning(
"QGraphicsView::dragLeaveEvent: drag leave received before drag enter");
3039 sceneEvent.setScenePos(
d->lastDragDropEvent->scenePos());
3040 sceneEvent.setScreenPos(
d->lastDragDropEvent->screenPos());
3041 sceneEvent.setButtons(
d->lastDragDropEvent->buttons());
3042 sceneEvent.setModifiers(
d->lastDragDropEvent->modifiers());
3043 sceneEvent.setPossibleActions(
d->lastDragDropEvent->possibleActions());
3044 sceneEvent.setProposedAction(
d->lastDragDropEvent->proposedAction());
3045 sceneEvent.setDropAction(
d->lastDragDropEvent->dropAction());
3046 sceneEvent.setMimeData(
d->lastDragDropEvent->mimeData());
3047 sceneEvent.setWidget(
d->lastDragDropEvent->widget());
3048 sceneEvent.setSource(
d->lastDragDropEvent->source());
3049 delete d->lastDragDropEvent;
3050 d->lastDragDropEvent =
nullptr;
3056 if (sceneEvent.isAccepted())
3057 event->setAccepted(
true);
3063void QGraphicsView::dragMoveEvent(QDragMoveEvent *
event)
3066 if (!
d->scene || !
d->sceneInteractionAllowed)
3071 d->populateSceneDragDropEvent(&sceneEvent,
event);
3074 d->storeDragDropEvent(&sceneEvent);
3080 event->setAccepted(sceneEvent.isAccepted());
3081 if (sceneEvent.isAccepted())
3082 event->setDropAction(sceneEvent.dropAction());
3092 d->updateInputMethodSensitivity();
3093 QAbstractScrollArea::focusInEvent(
event);
3097 if (!
d->scene || !
event->isAccepted())
3098 QAbstractScrollArea::focusInEvent(
event);
3106 return QAbstractScrollArea::focusNextPrevChild(
next);
3115 QAbstractScrollArea::focusOutEvent(
event);
3126 if (!
d->scene || !
d->sceneInteractionAllowed) {
3127 QAbstractScrollArea::keyPressEvent(
event);
3131 if (!
event->isAccepted())
3132 QAbstractScrollArea::keyPressEvent(
event);
3141 if (!
d->scene || !
d->sceneInteractionAllowed)
3144 if (!
event->isAccepted())
3145 QAbstractScrollArea::keyReleaseEvent(
event);
3154 if (!
d->scene || !
d->sceneInteractionAllowed)
3157 d->storeMouseEvent(
event);
3158 d->mousePressViewPoint =
event->position().toPoint();
3159 d->mousePressScenePoint =
mapToScene(
d->mousePressViewPoint);
3160 d->mousePressScreenPoint =
event->globalPosition().toPoint();
3161 d->lastMouseMoveScenePoint =
d->mousePressScenePoint;
3162 d->lastMouseMoveScreenPoint =
d->mousePressScreenPoint;
3163 d->mousePressButton =
event->button();
3180 if (
event->spontaneous())
3186 const bool isAccepted = mouseEvent.
isAccepted();
3187 event->setAccepted(isAccepted);
3190 d->lastMouseEvent.setAccepted(isAccepted);
3203 d->storeMouseEvent(
event);
3204 d->lastMouseEvent.setAccepted(
false);
3206 if (
d->sceneInteractionAllowed) {
3208 d->mousePressViewPoint =
event->position().toPoint();
3209 d->mousePressScenePoint =
mapToScene(
d->mousePressViewPoint);
3210 d->mousePressScreenPoint =
event->globalPosition().toPoint();
3211 d->lastMouseMoveScenePoint =
d->mousePressScenePoint;
3212 d->lastMouseMoveScreenPoint =
d->mousePressScreenPoint;
3213 d->mousePressButton =
event->button();
3232 if (
event->spontaneous())
3239 event->setAccepted(isAccepted);
3242 d->lastMouseEvent.setAccepted(isAccepted);
3249#if QT_CONFIG(rubberband)
3251 if (
d->sceneInteractionAllowed) {
3254 d->rubberBanding =
true;
3255 d->rubberBandRect =
QRect();
3259 if (extendSelection) {
3263 d->scene->clearSelection();
3272 d->handScrolling =
true;
3273 d->handScrollMotions = 0;
3288 if (
d->handScrolling) {
3291 QPoint delta =
event->position().toPoint() -
d->lastMouseEvent.position().toPoint();
3292 hBar->
setValue(hBar->
value() + (isRightToLeft() ? delta.
x() : -delta.
x()));
3297 ++
d->handScrollMotions;
3301 d->mouseMoveEventHandler(
event);
3311#if QT_CONFIG(rubberband)
3313 d->clearRubberBand();
3323 d->handScrolling =
false;
3325 if (
d->scene &&
d->sceneInteractionAllowed && !
d->lastMouseEvent.isAccepted() &&
d->handScrollMotions <= 6) {
3329 d->scene->clearSelection();
3333 d->storeMouseEvent(
event);
3335 if (!
d->sceneInteractionAllowed)
3356 if (
event->spontaneous())
3362 d->lastMouseEvent.setAccepted(mouseEvent.
isAccepted());
3367 d->_q_unsetViewportCursor();
3372#if QT_CONFIG(wheelevent)
3376void QGraphicsView::wheelEvent(QWheelEvent *
event)
3379 if (!
d->scene || !
d->sceneInteractionAllowed) {
3380 QAbstractScrollArea::wheelEvent(
event);
3389 wheelEvent.setScreenPos(
event->globalPosition().toPoint());
3390 wheelEvent.setButtons(
event->buttons());
3391 wheelEvent.setModifiers(
event->modifiers());
3392 const bool horizontal =
qAbs(
event->angleDelta().x()) >
qAbs(
event->angleDelta().y());
3393 wheelEvent.setDelta(horizontal ?
event->angleDelta().x() :
event->angleDelta().
y());
3394 wheelEvent.setPixelDelta(
event->pixelDelta());
3395 wheelEvent.setPhase(
event->phase());
3396 wheelEvent.setInverted(
event->isInverted());
3398 wheelEvent.setAccepted(
false);
3399 wheelEvent.setTimestamp(
event->timestamp());
3401 event->setAccepted(wheelEvent.isAccepted());
3402 if (!
event->isAccepted())
3403 QAbstractScrollArea::wheelEvent(
event);
3414 QAbstractScrollArea::paintEvent(
event);
3422 d->exposedRegion =
event->region();
3423 QRectF exposedSceneRect =
mapToScene(
d->exposedRegion.boundingRect()).boundingRect();
3427#if QT_CONFIG(rubberband)
3428 if (
d->rubberBanding && !
d->rubberBandRect.isEmpty())
3437 if (viewTransformed)
3441 const auto actuallyDraw = [&]() {
3446 if (
d->mustResizeBackgroundPixmap) {
3447 const qreal dpr =
d->viewport->devicePixelRatio();
3449 d->backgroundPixmap.setDevicePixelRatio(
dpr);
3454 p.fillRect(0, 0,
d->backgroundPixmap.width(),
d->backgroundPixmap.height(), bgBrush);
3456 d->mustResizeBackgroundPixmap =
false;
3460 if (!
d->backgroundPixmapExposed.isEmpty()) {
3461 QPainter backgroundPainter(&
d->backgroundPixmap);
3463 if (viewTransformed)
3465 QRectF backgroundExposedSceneRect =
mapToScene(
d->backgroundPixmapExposed.boundingRect()).boundingRect();
3467 d->backgroundPixmapExposed =
QRegion();
3471 if (viewTransformed) {
3489 const quint32 oldRectAdjust =
d->scene->d_func()->rectAdjust;
3491 d->scene->d_func()->rectAdjust = 1;
3493 d->scene->d_func()->rectAdjust = 2;
3494 d->scene->d_func()->drawItems(&
painter, viewTransformed ? &viewTransform :
nullptr,
3496 d->scene->d_func()->rectAdjust = oldRectAdjust;
3503 if (!
d->scene->d_func()->painterStateProtection)
3508 if (!
d->scene->d_func()->unpolishedItems.isEmpty())
3509 d->scene->d_func()->_q_polishItems();
3512 d->scene->d_func()->updateAll =
false;
3515 bool allItems =
false;
3519 const int numItems = itemList.
size();
3523 for (
int i = 0;
i < numItems; ++
i) {
3526 itemd->
initStyleOption(&styleOptionArray[
i], viewTransform,
d->exposedRegion, allItems);
3535 if (viewTransformed)
3544 d->freeStyleOptionsArray(styleOptionArray);
3551 #if QT_CONFIG(rubberband)
3553 if (
d->rubberBanding && !
d->rubberBandRect.isEmpty()) {
3555 QStyleOptionRubberBand
option;
3557 option.rect =
d->rubberBandRect;
3574 if (
d->stereoEnabled) {
3576 if (
w->toggleStereoTargetBuffer()) {
3578 w->toggleStereoTargetBuffer();
3585 d->scene->d_func()->painterStateProtection =
true;
3596 QPointF oldLastCenterPoint =
d->lastCenterPoint;
3598 QAbstractScrollArea::resizeEvent(
event);
3599 d->recalculateContentSize();
3602 if (
d->resizeAnchor ==
NoAnchor && !
d->keepLastCenterPoint) {
3603 d->updateLastCenterPoint();
3605 d->lastCenterPoint = oldLastCenterPoint;
3607 d->centerView(
d->resizeAnchor);
3608 d->keepLastCenterPoint =
false;
3612 d->mustResizeBackgroundPixmap =
true;
3622 d->dirtyScroll =
true;
3623 if (
d->transforming)
3625 if (isRightToLeft())
3630 if (
d->accelerateScrolling) {
3631#if QT_CONFIG(rubberband)
3633 if (!
d->rubberBandRect.isEmpty()) {
3635 rubberBandRegion += rubberBandRegion.
translated(-dx, -dy);
3636 viewport()->update(rubberBandRegion);
3639 d->dirtyScrollOffset.rx() += dx;
3640 d->dirtyScrollOffset.ry() += dy;
3641 d->dirtyRegion.translate(dx, dy);
3651 d->updateLastCenterPoint();
3656 const qreal dpr =
d->backgroundPixmap.devicePixelRatio();
3661 if (!
d->backgroundPixmap.isNull())
3662 d->backgroundPixmap.scroll(dx *
dpr, dy *
dpr,
d->backgroundPixmap.rect(), &exposed);
3665 d->backgroundPixmapExposed.translate(dx, dy);
3667 d->backgroundPixmapExposed += exposedScaled;
3671 if (
d->sceneInteractionAllowed)
3672 d->replayLastMouseEvent();
3681 d->recalculateContentSize();
3682 d->centerView(
d->transformationAnchor);
3683 QAbstractScrollArea::showEvent(
event);
3716 if (
d->scene &&
d->backgroundBrush.style() ==
Qt::NoBrush) {
3749 if (
d->scene &&
d->foregroundBrush.style() ==
Qt::NoBrush) {
3806 return d->identityMatrix ? moveMatrix :
d->matrix * moveMatrix;
3820 return !
d->identityMatrix ||
d->horizontalScroll() ||
d->verticalScroll();
3857 if (oldMatrix ==
d->matrix)
3860 d->identityMatrix =
d->matrix.isIdentity();
3861 d->transforming =
true;
3863 d->recalculateContentSize();
3864 d->centerView(
d->transformationAnchor);
3866 d->updateLastCenterPoint();
3869 if (
d->sceneInteractionAllowed)
3870 d->replayLastMouseEvent();
3871 d->transforming =
false;
3906 poly[0] =
x.map(tl);
3907 poly[1] =
x.map(
tr);
3908 poly[2] =
x.map(br);
3909 poly[3] =
x.map(bl);
3921#include "moc_qgraphicsview.cpp"
int value
the slider's current value
static QWidget * activeModalWidget()
Returns the active modal widget.
static QWidget * activePopupWidget()
Returns the active popup widget.
int startDragDistance
the minimum distance required for a drag and drop operation to start.
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or \nullptr if no applica...
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QCursor class provides a mouse cursor with an arbitrary shape.
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
virtual void setAccepted(bool accepted)
@ GraphicsSceneContextMenu
@ GraphicsSceneMouseRelease
@ GraphicsSceneMousePress
@ GraphicsSceneMouseDoubleClick
The QFocusEvent class contains event parameters for widget focus events.
The QGestureEvent class provides the description of triggered gestures.
void setWidget(QWidget *widget)
void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems=false) const
bool itemIsUntransformable() const
quint32 sceneTransformTranslateOnly
bool hasTranslateOnlySceneTransform()
TransformData * transformData
QTransform sceneTransform
QHash< QWidget *, QRect > paintedViewBoundingRects
virtual bool isProxyWidget() const
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QTransform deviceTransform(const QTransform &viewportTransform) const
QScopedPointer< QGraphicsItemPrivate > d_ptr
QPainterPath clipPath() const
virtual QPainterPath shape() const
Returns the shape of this item as a QPainterPath in local coordinates.
QRectF sceneBoundingRect() const
Returns the bounding rect of this item in scene coordinates, by combining sceneTransform() with bound...
virtual QRectF boundingRect() const =0
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
QCursor cursor() const
Returns the current cursor shape for the item.
bool isEnabled() const
Returns true if the item is enabled; otherwise, false is returned.
bool isClipped() const
Returns true if this item is clipped.
bool hasCursor() const
Returns true if this item has a cursor set; otherwise, false is returned.
QTransform sceneTransform() const
QRegion boundingRegion(const QTransform &itemToDeviceTransform) const
Qt::InputMethodHints inputMethodHints() const
Returns the current input method hints of this item.
GraphicsItemFlags flags() const
Returns this item's flags.
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
void setButtons(Qt::MouseButtons buttons)
void setMimeData(const QMimeData *data)
void setPossibleActions(Qt::DropActions actions)
void setProposedAction(Qt::DropAction action)
void setModifiers(Qt::KeyboardModifiers modifiers)
void setDropAction(Qt::DropAction action)
This function lets the receiver of the drop set the drop action that was performed to action,...
void setSource(QWidget *source)
void setScreenPos(const QPoint &pos)
void setScenePos(const QPointF &pos)
The QGraphicsSceneEvent class provides a base class for all graphics view related events.
void setWidget(QWidget *widget)
void setTimestamp(quint64 ts)
QWidget * widget() const
Returns the widget where the event originated, or \nullptr if the event originates from another appli...
The QGraphicsSceneHelpEvent class provides events when a tooltip is requested.
void setScenePos(const QPointF &pos)
void setScreenPos(const QPoint &pos)
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
void setFlags(Qt::MouseEventFlags)
void setLastScenePos(const QPointF &pos)
void setButton(Qt::MouseButton button)
void setScenePos(const QPointF &pos)
QPoint screenPos() const
Returns the mouse cursor position in screen coordinates.
Qt::MouseButtons buttons() const
Returns the combination of mouse buttons that were pressed at the time the event was sent.
void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos)
void setButtons(Qt::MouseButtons buttons)
QPointF scenePos() const
Returns the mouse cursor position in scene coordinates.
void setModifiers(Qt::KeyboardModifiers modifiers)
void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos)
void setLastScreenPos(const QPoint &pos)
void setSource(Qt::MouseEventSource source)
void setScreenPos(const QPoint &pos)
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
QList< QGraphicsItem * > items(Qt::SortOrder order=Qt::DescendingOrder) const
Returns an ordered list of all items on the scene.
QRectF sceneRect
the scene rectangle; the bounding rectangle of the scene
void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform)
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene's current focus item, or \nullptr if no it...
QRect mapToViewRect(const QGraphicsItem *item, const QRectF &rect) const
void storeDragDropEvent(const QGraphicsSceneDragDropEvent *event)
void replayLastMouseEvent()
QPointF mousePressScenePoint
QMutableSinglePointEvent lastMouseEvent
void freeStyleOptionsArray(QStyleOptionGraphicsItem *array)
quint32 useLastMouseEvent
bool hasStoredOriginalCursor
quint32 mustAllocateStyleOptions
void updateInputMethodSensitivity()
QPointer< QGraphicsScene > scene
bool updateRegion(const QRectF &rect, const QTransform &xform)
QGraphicsView::DragMode dragMode
bool updateRect(const QRect &rect)
void _q_setViewportCursor(const QCursor &cursor)
quint32 sceneInteractionAllowed
qint64 horizontalScroll() const
QPoint mousePressScreenPoint
bool updateRectF(const QRectF &rect)
quint32 mustResizeBackgroundPixmap
QGraphicsView::ViewportUpdateMode viewportUpdateMode
static void translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent)
QGraphicsView::OptimizationFlags optimizationFlags
qint64 verticalScroll() const
QRectF mapRectToScene(const QRect &rect) const
QList< QStyleOptionGraphicsItem > styleOptions
QList< QGraphicsItem * > findItems(const QRegion &exposedRegion, bool *allItems, const QTransform &viewTransform) const
QRectF mapRectFromScene(const QRectF &rect) const
void updateLastCenterPoint()
void populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest, QDropEvent *source)
QPointF mapToScene(const QPointF &point) const
void mouseMoveEventHandler(QMouseEvent *event)
QStyleOptionGraphicsItem * allocStyleOptionsArray(int numItems)
void recalculateContentSize()
void processPendingUpdates()
void _q_unsetViewportCursor()
quint32 fullUpdatePending
QGraphicsSceneDragDropEvent * lastDragDropEvent
void centerView(QGraphicsView::ViewportAnchor anchor)
QPoint mousePressViewPoint
QPoint lastMouseMoveScreenPoint
bool canStartScrollingAt(const QPoint &startPos) const override
QRegion mapToViewRegion(const QGraphicsItem *item, const QRectF &rect) const
QPointF lastMouseMoveScenePoint
QPointF lastRubberbandScenePoint
void storeMouseEvent(QMouseEvent *event)
Qt::MouseButton mousePressButton
void setUpdateClip(QGraphicsItem *)
QGraphicsView::CacheMode cacheMode
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
QPainter::RenderHints renderHints
the default render hints for the view
void mousePressEvent(QMouseEvent *event) override
\reimp
void setInteractive(bool allowed)
void shear(qreal sh, qreal sv)
Shears the current view transformation by (sh, sv).
QPointF mapToScene(const QPoint &point) const
Returns the viewport coordinate point mapped to scene coordinates.
void mouseMoveEvent(QMouseEvent *event) override
\reimp
QSize sizeHint() const override
\reimp
QList< QGraphicsItem * > items() const
Returns a list of all the items in the associated scene, in descending stacking order (i....
void setResizeAnchor(ViewportAnchor anchor)
void updateScene(const QList< QRectF > &rects)
Schedules an update of the scene rectangles rects.
void centerOn(const QPointF &pos)
Scrolls the contents of the viewport to ensure that the scene coordinate pos, is centered in the view...
void focusInEvent(QFocusEvent *event) override
\reimp
void updateSceneRect(const QRectF &rect)
Notifies QGraphicsView that the scene's scene rect has changed.
void setForegroundBrush(const QBrush &brush)
ViewportUpdateMode viewportUpdateMode
how the viewport should update its contents.
void setTransform(const QTransform &matrix, bool combine=false)
Sets the view's current transformation matrix to matrix.
bool isInteractive() const
void resetCachedContent()
Resets any cached content.
void setDragMode(DragMode mode)
QBrush backgroundBrush
the background brush of the scene.
void setRenderHints(QPainter::RenderHints hints)
void contextMenuEvent(QContextMenuEvent *event) override
\reimp
void setBackgroundBrush(const QBrush &brush)
void translate(qreal dx, qreal dy)
Translates the current view transformation by (dx, dy).
void setOptimizationFlag(OptimizationFlag flag, bool enabled=true)
Enables flag if enabled is true; otherwise disables flag.
Qt::Alignment alignment
the alignment of the scene in the view when the whole scene is visible.
bool isTransformed() const
void setupViewport(QWidget *widget) override
This slot is called by QAbstractScrollArea after setViewport() has been called.
QTransform transform() const
Returns the current transformation matrix for the view.
void resetTransform()
Resets the view transformation to the identity matrix.
bool viewportEvent(QEvent *event) override
\reimp
bool event(QEvent *event) override
\reimp
void scrollContentsBy(int dx, int dy) override
\reimp
void ensureVisible(const QRectF &rect, int xmargin=50, int ymargin=50)
Scrolls the contents of the viewport so that the scene rectangle rect is visible, with margins specif...
OptimizationFlags optimizationFlags
flags that can be used to tune QGraphicsView's performance.
bool focusNextPrevChild(bool next) override
\reimp
virtual void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[])
QVariant inputMethodQuery(Qt::InputMethodQuery query) const override
\reimp
void mouseDoubleClickEvent(QMouseEvent *event) override
\reimp
void paintEvent(QPaintEvent *event) override
\reimp
void inputMethodEvent(QInputMethodEvent *event) override
\reimp
QRectF sceneRect
the area of the scene visualized by this view.
void mouseReleaseEvent(QMouseEvent *event) override
\reimp
virtual void drawForeground(QPainter *painter, const QRectF &rect)
Draws the foreground of the scene using painter, after the background and all items are drawn.
void scale(qreal sx, qreal sy)
Scales the current view transformation by (sx, sy).
virtual void drawBackground(QPainter *painter, const QRectF &rect)
Draws the background of the scene using painter, before any items and the foreground are drawn.
void focusOutEvent(QFocusEvent *event) override
\reimp
void invalidateScene(const QRectF &rect=QRectF(), QGraphicsScene::SceneLayers layers=QGraphicsScene::AllLayers)
Invalidates and schedules a redraw of layers inside rect.
ViewportAnchor
This enums describe the possible anchors that QGraphicsView can use when the user resizes the view or...
void fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio)
Scales the view matrix and scrolls the scroll bars to ensure that the scene rectangle rect fits insid...
void setCacheMode(CacheMode mode)
QTransform viewportTransform() const
Returns a matrix that maps scene coordinates to viewport coordinates.
ViewportAnchor transformationAnchor
how the view should position the scene during transformations.
void resizeEvent(QResizeEvent *event) override
\reimp
DragMode dragMode
the behavior for dragging the mouse over the scene while the left mouse button is pressed.
DragMode
This enum describes the default action for the view when pressing and dragging the mouse over the vie...
void setRenderHint(QPainter::RenderHint hint, bool enabled=true)
If enabled is true, the render hint hint is enabled; otherwise it is disabled.
~QGraphicsView()
Destructs the QGraphicsView object.
QGraphicsItem * itemAt(const QPoint &pos) const
Returns the item at position pos, which is in viewport coordinates.
void keyPressEvent(QKeyEvent *event) override
\reimp
void render(QPainter *painter, const QRectF &target=QRectF(), const QRect &source=QRect(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio)
Renders the source rect, which is in view coordinates, from the scene into target,...
void setScene(QGraphicsScene *scene)
Sets the current scene to scene.
@ BoundingRectViewportUpdate
@ DontAdjustForAntialiasing
void keyReleaseEvent(QKeyEvent *event) override
\reimp
void showEvent(QShowEvent *event) override
\reimp
QGraphicsView(QWidget *parent=nullptr)
Constructs a QGraphicsView.
ViewportAnchor resizeAnchor
how the view should position the scene when the view is resized.
QPoint mapFromScene(const QPointF &point) const
Returns the scene coordinate point to viewport coordinates.
void setTransformationAnchor(ViewportAnchor anchor)
QGraphicsScene * scene() const
Returns a pointer to the scene that is currently visualized in the view.
void setOptimizationFlags(OptimizationFlags flags)
void rotate(qreal angle)
Rotates the current view transformation angle degrees clockwise.
void setSceneRect(const QRectF &rect)
void setViewportUpdateMode(ViewportUpdateMode mode)
QBrush foregroundBrush
the foreground brush of the scene.
CacheMode cacheMode
which parts of the view are cached
void setAlignment(Qt::Alignment alignment)
QScreen * primaryScreen
the primary (or default) screen of the application.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QHelpEvent class provides an event that is used to request helpful information about a particular...
const QPoint & globalPos() const
Returns the mouse cursor position when the event was generated in global coordinates.
const QPoint & pos() const
Returns the mouse cursor position when the event was generated, relative to the widget to which the e...
The QKeyEvent class describes a key event.
int key() const
Returns the code of the key that was pressed or released.
qsizetype size() const noexcept
bool isEmpty() const noexcept
qsizetype capacity() const
const_reference at(qsizetype i) const noexcept
void reserve(qsizetype size)
void resize(qsizetype size)
static QMutableTouchEvent * from(QTouchEvent *e)
void setTarget(QObject *target)
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
virtual int devType() const
The QPaintEvent class contains event parameters for paint events.
void translate(qreal dx, qreal dy)
Translates all elements in the path by ({dx}, {dy}).
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
The QPainter class performs low-level painting on widgets and other paint devices.
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or \nullptr if the painter is n...
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation.
void setClipPath(const QPainterPath &path, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip path for the painter to the given path, with the clip operation.
void restore()
Restores the current painter state (pops a saved state off the stack).
const QTransform & worldTransform() const
Returns the world transformation matrix.
void setOpacity(qreal opacity)
void save()
Saves the current painter state (pushes the state onto a stack).
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
RenderHint
Renderhints are used to specify flags to QPainter that may or may not be respected by any given engin...
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false.
void setRenderHints(RenderHints hints, bool on=true)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
void setTransform(const QTransform &transform, bool combine=false)
bool testRenderHint(RenderHint hint) const
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr bool isNull() const noexcept
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
constexpr int & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
virtual void setAccepted(bool accepted) override
\reimp
The QPolygonF class provides a list of points using floating point precision.
QRectF Q_GUI_EXPORT boundingRect() const
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty.
The QPolygon class provides a list of points using integer precision.
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
QRect toAlignedRect() const noexcept
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
bool contains(const QRectF &r) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
constexpr void translate(qreal dx, qreal dy) noexcept
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr void setRect(qreal x, qreal y, qreal w, qreal h) noexcept
Sets the coordinates of the rectangle's top-left corner to (x, y), and its size to the given width an...
\inmodule QtCore\reentrant
bool intersects(const QRect &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e., there is at least one pixel...
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr QRect adjusted(int x1, int y1, int x2, int y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr QRect translated(int dx, int dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
The QRegion class specifies a clip region for a painter.
QRect boundingRect() const noexcept
Returns the bounding rectangle of this region.
int rectCount() const noexcept
QRegion translated(int dx, int dy) const
The QResizeEvent class contains event parameters for resize events.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
The QShowEvent class provides an event that is sent when a widget is shown.
A base class for pointer events containing a single point, such as mouse events.
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
constexpr QSize toSize() const noexcept
Returns an integer based copy of this size.
constexpr QSizeF boundedTo(const QSizeF &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
The QStyleHintReturnMask class provides style hints that return a QRegion.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
@ SH_ScrollView_FrameOnlyAroundContents
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
QEventPoint & point(int touchId)
The QTouchEvent class contains parameters that describe a touch event.
Combined button and popup list for selecting options.
@ KeepAspectRatioByExpanding
@ IntersectsItemBoundingRect
constexpr Initialization Uninitialized
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const EGLAttrib EGLOutputLayerEXT * layers
static QRectF adjustedItemEffectiveBoundingRect(const QGraphicsItem *item)
static bool intersectsViewport(const QRect &r, int width, int height)
static bool containsViewport(const QRect &r, int width, int height)
static void QRect_unite(QRect *rect, const QRect &other)
static const int QGRAPHICSVIEW_REGION_RECT_THRESHOLD
QPainterPath qt_regionToPath(const QRegion ®ion)
QT_BEGIN_NAMESPACE bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
int q_round_bound(qreal d)
static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei GLsizei GLchar * source
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLenum GLenum GLenum GLenum GLenum scale
static const QRectF boundingRect(const QPointF *points, int pointCount)
QPainterPath qt_regionToPath(const QRegion ®ion)
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define QT_CONFIG(feature)
if(qFloatDistance(a, b)<(1<< 7))
[0]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
obj metaObject() -> className()
myObject disconnect()
[26]
view viewport() -> scroll(dx, dy, deviceRect)
app setAttribute(Qt::AA_DontShowIconsInMenus)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent