280 #ifndef QT_NO_GRAPHICSVIEW 289 #include <QtCore/qdatetime.h> 290 #include <QtCore/qdebug.h> 291 #include <QtCore/qmath.h> 292 #include <QtGui/qapplication.h> 293 #include <QtGui/qdesktopwidget.h> 294 #include <QtGui/qevent.h> 295 #include <QtGui/qlayout.h> 296 #include <QtGui/qtransform.h> 297 #include <QtGui/qmatrix.h> 298 #include <QtGui/qpainter.h> 299 #include <QtGui/qscrollbar.h> 300 #include <QtGui/qstyleoption.h> 301 #include <QtGui/qinputcontext.h> 303 #include <QtGui/qpaintengine.h> 304 #include <private/qt_x11_p.h> 307 #include <private/qevent_p.h> 315 if (d <= (
qreal) INT_MIN)
319 return d >= 0.0 ? int(d +
qreal(0.5)) : int(d -
int(d-1) +
qreal(0.5)) + int(d-1);
325 for (
int i = 0; i < touchPoints.
count(); ++i) {
387 QSize maxSize = q->maximumViewportSize();
388 int width = maxSize.
width();
389 int height = maxSize.
height();
393 if (frameOnlyAround) {
408 if (useHorizontalScrollBar && !useVerticalScrollBar) {
409 if (viewRect.
height() > height - scrollBarExtent)
410 useVerticalScrollBar =
true;
412 if (useVerticalScrollBar && !useHorizontalScrollBar) {
413 if (viewRect.
width() > width - scrollBarExtent)
414 useHorizontalScrollBar =
true;
417 height -= scrollBarExtent;
419 width -= scrollBarExtent;
491 }
else if (q->isRightToLeft() && !
leftIndent) {
513 if (q->underMouse()) {
606 if (q->isRightToLeft()) {
638 event->button(),
event->buttons(),
event->modifiers());
688 if (
scene->d_func()->allItemsIgnoreHoverEvents && !
scene->d_func()->allItemsUseDefaultCursor
689 &&
scene->d_func()->cachedItemsUnderMouse.isEmpty()) {
690 scene->d_func()->cachedItemsUnderMouse =
scene->d_func()->itemsAtPosition(mouseEvent.
screenPos(),
714 #ifndef QT_NO_RUBBERBAND 796 #ifndef QT_NO_DRAGANDDROP 825 return itv.
mapRect(rect).toAlignedRect();
837 offset += itemd->
pos;
838 }
while ((parentItem = itemd->
parent));
892 {
return !(r.
left() > width) && !(r.
right() < 0) && !(r.
top() >= height) && !(r.
bottom() < 0); }
895 {
return r.
left() <= 0 && r.
top() <= 0 && r.
right() >= width - 1 && r.
bottom() >= height - 1; }
935 clip = r.toAlignedRect();
936 }
else if (!q->isTransformed()) {
940 xform *= q->viewportTransform();
967 QRect viewRect = region.boundingRect();
969 if (dontAdjustForAntialiasing)
970 viewRect.
adjust(-1, -1, 1, 1);
972 viewRect.
adjust(-2, -2, 2, 2);
977 for (
int i = 0; i < rects.
size(); ++i) {
978 viewRect = rects.
at(i);
979 if (dontAdjustForAntialiasing)
980 viewRect.
adjust(-1, -1, 1, 1);
982 viewRect.
adjust(-2, -2, 2, 2);
1083 if (simpleRectLookup) {
1084 return scene->
items(exposedRegionSceneBounds,
1093 foreach (
const QRect &r, exposedRegion.
rects())
1094 adjustedRegion += r.
adjusted(-1, -1, 1, 1);
1121 q->setInputMethodHints(0);
1134 q->setInputMethodHints(0);
1189 d->scene->d_func()->views.removeAll(
this);
1190 delete d->lastDragDropEvent;
1201 baseSize +=
QSizeF(
d->frameWidth * 2,
d->frameWidth * 2);
1228 return d->renderHints;
1233 if (hints ==
d->renderHints)
1235 d->renderHints = hints;
1248 QPainter::RenderHints oldHints =
d->renderHints;
1250 d->renderHints |= hint;
1252 d->renderHints &= ~hint;
1253 if (oldHints !=
d->renderHints)
1275 return d->alignment;
1280 if (
d->alignment != alignment) {
1282 d->recalculateContentSize();
1310 return d->transformationAnchor;
1315 d->transformationAnchor = anchor;
1320 d->viewport->setMouseTracking(
true);
1345 return d->resizeAnchor;
1350 d->resizeAnchor = anchor;
1355 d->viewport->setMouseTracking(
true);
1382 return d->viewportUpdateMode;
1387 d->viewportUpdateMode = mode;
1414 return d->optimizationFlags;
1419 d->optimizationFlags = flags;
1431 d->optimizationFlags |= flag;
1433 d->optimizationFlags &= ~flag;
1461 if (
d->dragMode == mode)
1464 #ifndef QT_NO_CURSOR 1474 d->handScrolling =
false;
1478 #ifndef QT_NO_CURSOR 1481 d->hasStoredOriginalCursor =
false;
1487 #ifndef QT_NO_RUBBERBAND 1507 return d->rubberBandSelectionMode;
1512 d->rubberBandSelectionMode = mode;
1542 return d->cacheMode;
1547 if (mode ==
d->cacheMode)
1549 d->cacheMode = mode;
1574 d->mustResizeBackgroundPixmap =
true;
1576 }
else if (
d->mustResizeBackgroundPixmap) {
1579 d->mustResizeBackgroundPixmap =
false;
1581 d->backgroundPixmapExposed =
QRegion();
1609 d->backgroundPixmapExposed += viewRect;
1611 d->scene->update(rect);
1632 return d->sceneInteractionAllowed;
1637 d->sceneInteractionAllowed = allowed;
1663 if (
d->scene == scene)
1675 d->scene->d_func()->removeView(
this);
1676 d->connectedToScene =
false;
1683 d->scene->clearFocus();
1687 if ((
d->scene = scene)) {
1690 d->updateSceneSlotReimplementedChecked =
false;
1691 d->scene->d_func()->addView(
this);
1692 d->recalculateContentSize();
1694 d->keepLastCenterPoint =
true;
1697 if (!
d->scene->d_func()->allItemsIgnoreHoverEvents
1698 || !
d->scene->d_func()->allItemsUseDefaultCursor) {
1699 d->viewport->setMouseTracking(
true);
1703 if (!
d->scene->d_func()->allItemsIgnoreTouchEvents)
1711 d->recalculateContentSize();
1714 d->updateInputMethodSensitivity();
1717 d->scene->setFocus();
1749 if (
d->hasSceneRect)
1750 return d->sceneRect;
1752 return d->scene->sceneRect();
1758 d->hasSceneRect = !rect.
isNull();
1759 d->sceneRect =
rect;
1760 d->recalculateContentSize();
1772 return d->matrix.toAffine();
1838 matrix.
scale(sx, sy);
1851 matrix.
shear(sh, sv);
1885 QPointF viewPoint =
d->matrix.map(pos);
1888 if (!
d->leftIndent) {
1893 horizontal -= int(viewPoint.
x() - width /
qreal(2.0));
1901 d->lastCenterPoint = oldCenterPoint;
1945 QRectF viewRect =
d->matrix.mapRect(rect);
1949 qreal top =
d->verticalScroll();
1952 if (viewRect.
left() <= left + xmargin) {
1957 if (viewRect.
right() >= right - xmargin) {
1962 if (viewRect.
top() <= top + ymargin) {
1967 if (viewRect.
bottom() >= bottom - ymargin) {
2031 if (!
d->scene || rect.
isNull())
2052 switch (aspectRatioMode) {
2054 xratio = yratio =
qMin(xratio, yratio);
2057 xratio = yratio =
qMax(xratio, yratio);
2064 scale(xratio, yratio);
2131 if (!
d->scene || !(painter && painter->
isActive()))
2135 QRect sourceRect = source;
2140 QRectF targetRect = target;
2143 targetRect = sourceRect;
2153 switch (aspectRatioMode) {
2155 xratio = yratio =
qMin(xratio, yratio);
2158 xratio = yratio =
qMax(xratio, yratio);
2170 int numItems = itemList.size();
2171 for (
int i = 0; i < numItems; ++i)
2172 itemArray[numItems - i - 1] = itemList.at(i);
2177 QTransform painterMatrix =
d->matrix * moveMatrix;
2180 .
scale(xratio, yratio)
2181 .translate(-sourceRect.
left(), -sourceRect.
top());
2185 for (
int i = 0; i < numItems; ++i)
2186 itemArray[i]->
d_ptr->initStyleOption(&styleOptionArray[i], painterMatrix, targetRect.
toRect());
2203 drawItems(painter, numItems, itemArray, styleOptionArray);
2206 delete [] itemArray;
2207 d->freeStyleOptionsArray(styleOptionArray);
2224 return d->scene->items();
2398 p.
rx() +=
d->horizontalScroll();
2399 p.
ry() +=
d->verticalScroll();
2400 return d->identityMatrix ? p :
d->matrix.inverted().map(p);
2425 QPointF scrollOffset(
d->horizontalScroll(),
d->verticalScroll());
2427 QPointF tl = scrollOffset + r.topLeft();
2428 QPointF tr = scrollOffset + r.topRight();
2429 QPointF br = scrollOffset + r.bottomRight();
2430 QPointF bl = scrollOffset + r.bottomLeft();
2433 if (!
d->identityMatrix) {
2435 poly[0] = x.
map(tl);
2436 poly[1] = x.
map(tr);
2437 poly[2] = x.
map(br);
2438 poly[3] = x.
map(bl);
2467 foreach (
const QPoint &point, polygon)
2482 matrix *=
d->matrix.inverted();
2483 return matrix.map(path);
2494 QPointF p =
d->identityMatrix ? point :
d->matrix.map(point);
2495 p.
rx() -=
d->horizontalScroll();
2496 p.
ry() -=
d->verticalScroll();
2523 if (!
d->identityMatrix) {
2535 QPointF scrollOffset(
d->horizontalScroll(),
d->verticalScroll());
2542 poly[0] = tl.toPoint();
2568 foreach (
const QPointF &point, polygon)
2584 return matrix.
map(path);
2596 QVariant value =
d->scene->inputMethodQuery(query);
2598 value =
d->mapRectFromScene(value.
toRectF());
2602 value =
d->mapRectFromScene(value.
toRect()).toRect();
2627 return d->backgroundBrush;
2632 d->backgroundBrush = brush;
2637 d->mustResizeBackgroundPixmap =
true;
2660 return d->foregroundBrush;
2665 d->foregroundBrush = brush;
2688 for (
int i = 0; i < dirtyRects.
size(); ++i)
2689 dirtyViewportRects += dirtyRects.
at(i);
2691 d->dirtyBoundingRect =
QRect();
2701 bool redraw =
false;
2708 xrect.
adjust(-2, -2, 2, 2);
2710 xrect.
adjust(-1, -1, 1, 1);
2713 dirtyViewportRects << xrect;
2716 foreach (
const QRect &rect, dirtyViewportRects) {
2719 if (!boundingRectUpdate) {
2720 updateRegion +=
rect;
2722 boundingRect |=
rect;
2737 else if (boundingRectUpdate)
2753 if (!
d->hasSceneRect) {
2754 d->sceneRect =
rect;
2755 d->recalculateContentSize();
2771 qWarning(
"QGraphicsView::setupViewport: cannot initialize null widget");
2775 const bool isGLWidget = widget->
inherits(
"QGLWidget");
2777 d->accelerateScrolling = !(isGLWidget);
2789 if ((
d->scene && (!
d->scene->d_func()->allItemsIgnoreHoverEvents
2790 || !
d->scene->d_func()->allItemsUseDefaultCursor))
2797 if (
d->scene && !
d->scene->d_func()->allItemsIgnoreTouchEvents)
2800 #ifndef QT_NO_GESTURES 2802 foreach (
Qt::GestureType gesture,
d->scene->d_func()->grabbedGestures.keys())
2817 if (
d->sceneInteractionAllowed) {
2818 switch (event->
type()) {
2860 switch (event->
type()) {
2872 if (!
d->scene->d_func()->popupWidgets.isEmpty())
2873 d->scene->d_func()->removePopup(
d->scene->d_func()->popupWidgets.first());
2896 if (!
d->scene->d_func()->popupWidgets.isEmpty())
2897 d->scene->d_func()->removePopup(
d->scene->d_func()->popupWidgets.first());
2899 d->useLastMouseEvent =
false;
2902 event->d =
reinterpret_cast<QEventPrivate *
>(
viewport());
2905 #ifndef QT_NO_TOOLTIP 2919 d->fullUpdatePending =
false;
2920 d->dirtyScrollOffset =
QPoint();
2925 if (!
d->updateSceneSlotReimplementedChecked) {
2926 d->updateSceneSlotReimplementedChecked =
true;
2945 if (
d->scene &&
d->sceneInteractionAllowed) {
2955 #ifndef QT_NO_GESTURES 2962 if (
d->scene &&
d->sceneInteractionAllowed) {
2969 #endif // QT_NO_GESTURES 2977 #ifndef QT_NO_CONTEXTMENU 2984 if (!
d->scene || !
d->sceneInteractionAllowed)
2987 d->mousePressViewPoint =
event->pos();
2988 d->mousePressScenePoint =
mapToScene(
d->mousePressViewPoint);
2989 d->mousePressScreenPoint =
event->globalPos();
2990 d->lastMouseMoveScenePoint =
d->mousePressScenePoint;
2991 d->lastMouseMoveScreenPoint =
d->mousePressScreenPoint;
3001 event->setAccepted(contextEvent.
isAccepted());
3003 #endif // QT_NO_CONTEXTMENU 3010 #ifndef QT_NO_DRAGANDDROP 3012 if (!
d->scene || !
d->sceneInteractionAllowed)
3017 d->populateSceneDragDropEvent(&sceneEvent, event);
3027 delete d->lastDragDropEvent;
3028 d->lastDragDropEvent = 0;
3040 #ifndef QT_NO_DRAGANDDROP 3042 if (!
d->scene || !
d->sceneInteractionAllowed)
3046 d->useLastMouseEvent =
false;
3050 d->populateSceneDragDropEvent(&sceneEvent, event);
3053 d->storeDragDropEvent(&sceneEvent);
3060 event->setAccepted(
true);
3061 event->setDropAction(sceneEvent.
dropAction());
3073 #ifndef QT_NO_DRAGANDDROP 3075 if (!
d->scene || !
d->sceneInteractionAllowed)
3077 if (!
d->lastDragDropEvent) {
3078 qWarning(
"QGraphicsView::dragLeaveEvent: drag leave received before drag enter");
3084 sceneEvent.
setScenePos(
d->lastDragDropEvent->scenePos());
3086 sceneEvent.
setButtons(
d->lastDragDropEvent->buttons());
3091 sceneEvent.
setMimeData(
d->lastDragDropEvent->mimeData());
3092 sceneEvent.
setWidget(
d->lastDragDropEvent->widget());
3093 sceneEvent.
setSource(
d->lastDragDropEvent->source());
3094 delete d->lastDragDropEvent;
3095 d->lastDragDropEvent = 0;
3113 #ifndef QT_NO_DRAGANDDROP 3115 if (!
d->scene || !
d->sceneInteractionAllowed)
3120 d->populateSceneDragDropEvent(&sceneEvent, event);
3123 d->storeDragDropEvent(&sceneEvent);
3143 d->updateInputMethodSensitivity();
3177 if (!
d->scene || !
d->sceneInteractionAllowed) {
3192 if (!
d->scene || !
d->sceneInteractionAllowed)
3205 if (!
d->scene || !
d->sceneInteractionAllowed)
3208 d->storeMouseEvent(event);
3209 d->mousePressViewPoint =
event->pos();
3210 d->mousePressScenePoint =
mapToScene(
d->mousePressViewPoint);
3211 d->mousePressScreenPoint =
event->globalPos();
3212 d->lastMouseMoveScenePoint =
d->mousePressScenePoint;
3213 d->lastMouseMoveScreenPoint =
d->mousePressScreenPoint;
3214 d->mousePressButton =
event->button();
3245 d->storeMouseEvent(event);
3246 d->lastMouseEvent.setAccepted(
false);
3248 if (
d->sceneInteractionAllowed) {
3250 d->mousePressViewPoint =
event->pos();
3251 d->mousePressScenePoint =
mapToScene(
d->mousePressViewPoint);
3252 d->mousePressScreenPoint =
event->globalPos();
3253 d->lastMouseMoveScenePoint =
d->mousePressScenePoint;
3254 d->lastMouseMoveScreenPoint =
d->mousePressScreenPoint;
3255 d->mousePressButton =
event->button();
3278 event->setAccepted(isAccepted);
3281 d->lastMouseEvent.setAccepted(isAccepted);
3288 #ifndef QT_NO_RUBBERBAND 3290 if (
d->sceneInteractionAllowed) {
3293 d->rubberBanding =
true;
3294 d->rubberBandRect =
QRect();
3297 d->scene->clearSelection();
3305 d->handScrolling =
true;
3306 d->handScrollMotions = 0;
3307 #ifndef QT_NO_CURSOR 3320 #ifndef QT_NO_RUBBERBAND 3322 d->storeMouseEvent(event);
3323 if (
d->rubberBanding) {
3325 if ((
d->mousePressViewPoint - event->
pos()).manhattanLength()
3341 d->rubberBanding =
false;
3342 d->rubberBandRect =
QRect();
3347 const QPoint &mp =
d->mousePressViewPoint;
3348 QPoint ep =
event->pos();
3364 d->scene->setSelectionArea(selectionArea,
d->rubberBandSelectionMode,
3369 #endif // QT_NO_RUBBERBAND 3371 if (
d->handScrolling) {
3374 QPoint delta =
event->pos() -
d->lastMouseEvent.pos();
3380 ++
d->handScrollMotions;
3384 d->mouseMoveEventHandler(event);
3394 #ifndef QT_NO_RUBBERBAND 3396 if (
d->rubberBanding) {
3403 d->rubberBanding =
false;
3404 d->rubberBandRect =
QRect();
3409 #ifndef QT_NO_CURSOR 3415 d->handScrolling =
false;
3417 if (
d->scene &&
d->sceneInteractionAllowed && !
d->lastMouseEvent.isAccepted() &&
d->handScrollMotions <= 6) {
3421 d->scene->clearSelection();
3425 d->storeMouseEvent(event);
3427 if (!
d->sceneInteractionAllowed)
3451 d->lastMouseEvent.setAccepted(mouseEvent.
isAccepted());
3453 #ifndef QT_NO_CURSOR 3456 d->_q_unsetViewportCursor();
3461 #ifndef QT_NO_WHEELEVENT 3468 if (!
d->scene || !
d->sceneInteractionAllowed) {
3489 #endif // QT_NO_WHEELEVENT 3506 d->exposedRegion =
event->region();
3511 #ifndef QT_NO_RUBBERBAND 3512 if (
d->rubberBanding && !
d->rubberBandRect.isEmpty())
3521 if (viewTransformed)
3533 if (
d->mustResizeBackgroundPixmap) {
3539 p.
fillRect(0, 0,
d->backgroundPixmap.width(),
d->backgroundPixmap.height(), bgBrush);
3541 d->mustResizeBackgroundPixmap =
false;
3545 if (!
d->backgroundPixmapExposed.isEmpty()) {
3546 QPainter backgroundPainter(&
d->backgroundPixmap);
3548 if (viewTransformed)
3552 d->backgroundPixmapExposed =
QRegion();
3556 if (viewTransformed) {
3573 const quint32 oldRectAdjust =
d->scene->d_func()->rectAdjust;
3575 d->scene->d_func()->rectAdjust = 1;
3577 d->scene->d_func()->rectAdjust = 2;
3578 d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : 0,
3580 d->scene->d_func()->rectAdjust = oldRectAdjust;
3587 if (!
d->scene->d_func()->painterStateProtection)
3592 if (!
d->scene->d_func()->unpolishedItems.isEmpty())
3593 d->scene->d_func()->_q_polishItems();
3596 d->scene->d_func()->updateAll =
false;
3599 bool allItems =
false;
3603 const int numItems = itemList.
size();
3607 for (
int i = 0; i < numItems; ++i) {
3610 itemd->
initStyleOption(&styleOptionArray[i], viewTransform,
d->exposedRegion, allItems);
3619 if (viewTransformed)
3620 transform *= viewTransform;
3627 drawItems(&painter, numItems, itemArray, styleOptionArray);
3628 d->freeStyleOptionsArray(styleOptionArray);
3635 #ifndef QT_NO_RUBBERBAND 3637 if (
d->rubberBanding && !
d->rubberBandRect.isEmpty()) {
3641 option.
rect =
d->rubberBandRect;
3657 d->scene->d_func()->painterStateProtection =
true;
3668 QPointF oldLastCenterPoint =
d->lastCenterPoint;
3671 d->recalculateContentSize();
3674 if (
d->resizeAnchor ==
NoAnchor && !
d->keepLastCenterPoint) {
3675 d->updateLastCenterPoint();
3677 d->lastCenterPoint = oldLastCenterPoint;
3679 d->centerView(
d->resizeAnchor);
3680 d->keepLastCenterPoint =
false;
3684 d->mustResizeBackgroundPixmap =
true;
3694 d->dirtyScroll =
true;
3695 if (
d->transforming)
3702 if (
d->accelerateScrolling) {
3703 #ifndef QT_NO_RUBBERBAND 3705 if (!
d->rubberBandRect.isEmpty()) {
3707 rubberBandRegion += rubberBandRegion.
translated(-dx, -dy);
3711 d->dirtyScrollOffset.rx() += dx;
3712 d->dirtyScrollOffset.ry() += dy;
3713 d->dirtyRegion.translate(dx, dy);
3723 d->updateLastCenterPoint();
3732 if (!
d->backgroundPixmap.isNull())
3733 d->backgroundPixmap.scroll(dx, dy,
d->backgroundPixmap.rect(), &exposed);
3736 d->backgroundPixmapExposed.translate(dx, dy);
3737 d->backgroundPixmapExposed += exposed;
3741 if (
d->sceneInteractionAllowed)
3742 d->replayLastMouseEvent();
3751 d->recalculateContentSize();
3752 d->centerView(
d->transformationAnchor);
3786 if (
d->scene &&
d->backgroundBrush.style() ==
Qt::NoBrush) {
3787 d->scene->drawBackground(painter, rect);
3791 painter->
fillRect(rect,
d->backgroundBrush);
3814 if (
d->scene &&
d->foregroundBrush.style() ==
Qt::NoBrush) {
3815 d->scene->drawForeground(painter, rect);
3819 painter->
fillRect(rect,
d->foregroundBrush);
3849 d->scene->drawItems(painter, numItems, items, options, widget);
3874 return d->identityMatrix ? moveMatrix :
d->matrix * moveMatrix;
3891 return !
d->identityMatrix ||
d->horizontalScroll() ||
d->verticalScroll();
3927 d->matrix = matrix *
d->matrix;
3928 if (oldMatrix ==
d->matrix)
3931 d->identityMatrix =
d->matrix.isIdentity();
3932 d->transforming =
true;
3934 d->recalculateContentSize();
3935 d->centerView(
d->transformationAnchor);
3937 d->updateLastCenterPoint();
3940 if (
d->sceneInteractionAllowed)
3941 d->replayLastMouseEvent();
3942 d->transforming =
false;
3961 p.
rx() += horizontalScroll();
3962 p.
ry() += verticalScroll();
3968 QPointF scrollOffset(horizontalScroll(), verticalScroll());
3975 if (!identityMatrix) {
3977 poly[0] = x.
map(tl);
3978 poly[1] = x.
map(tr);
3979 poly[2] = x.
map(br);
3980 poly[3] = x.
map(bl);
3992 #include "moc_qgraphicsview.cpp" 3994 #endif // QT_NO_GRAPHICSVIEW
The QVariant class acts like a union for the most common Qt data types.
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
Qt::DropAction dropAction() const
Returns the action that was performed in this drag and drop.
const QMimeData * mimeData() const
This function returns the MIME data of the event.
The QPainter class performs low-level painting on widgets and other paint devices.
ViewportAnchor resizeAnchor() const
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
void updateScene(const QList< QRectF > &rects)
Schedules an update of the scene rectangles rects.
void setModifiers(Qt::KeyboardModifiers modifiers)
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
QPointF bottomRight() const
Returns the position of the rectangle's bottom-right corner.
bool isClipped() const
Returns true if this item is clipped.
void setSource(QWidget *source)
This function set the source widget, i.
bool focusNextPrevChild(bool next)
Reimplemented Function
void setScenePos(const QPointF &pos)
Sets the scene position of the mouse to pos.
bool updateRectF(const QRectF &rect)
QPoint mousePressScreenPoint
void storeDragDropEvent(const QGraphicsSceneDragDropEvent *event)
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items...
DragMode
This enum describes the default action for the view when pressing and dragging the mouse over the vie...
void setResizeAnchor(ViewportAnchor anchor)
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
The QKeyEvent class describes a key event.
QPoint screenPos() const
Returns the mouse cursor position in screen coordinates.
void focusInEvent(QFocusEvent *event)
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
OptimizationFlags optimizationFlags() const
The QCursor class provides a mouse cursor with an arbitrary shape.
static QRectF adjustedItemEffectiveBoundingRect(const QGraphicsItem *item)
QSize sizeHint() const
Reimplemented Function
void setAlignment(Qt::Alignment alignment)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
QPointF mapToScene(const QPoint &point) const
Returns the viewport coordinate point mapped to scene coordinates.
OptimizationFlag
This enum describes flags that you can enable to improve rendering performance in QGraphicsView...
bool isTransformed() const
Returns true if the view is transformed (i.
void storeMouseEvent(QMouseEvent *event)
#define QT_END_NAMESPACE
This macro expands to.
QGraphicsView::CacheMode cacheMode
QMatrix matrix() const
Returns the current transformation matrix for the view.
QPointF toPointF() const
Returns the variant as a QPointF if the variant has type() Point or PointF ; otherwise returns a null...
void setModifiers(Qt::KeyboardModifiers modifiers)
QScopedPointer< QGraphicsLayoutItemPrivate > d_ptr
QPointer< QWidget > widget
void setScenePos(const QPointF &pos)
Sets the position associated with the context menu to the given point in scene coordinates.
void translate(qreal dx, qreal dy)
Translates all elements in the path by ({dx}, {dy}).
void rotate(qreal angle)
Rotates the current view transformation angle degrees clockwise.
QScopedPointer< QGraphicsItemPrivate > d_ptr
static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS
void updateLastCenterPoint()
void keyPressEvent(QKeyEvent *event)
Reimplemented Function
T * data() const
Returns the value of the pointer referenced by this object.
QPointF mousePressScenePoint
bool hasTranslateOnlySceneTransform()
The QMatrix class specifies 2D transformations of a coordinate system.
void contextMenuEvent(QContextMenuEvent *event)
Reimplemented Function
QTransform sceneTransform() const
Returns this item's scene transformation matrix.
QSize toSize() const
Returns an integer based copy of this size.
Qt::DropActions possibleActions() const
Returns an OR-combination of possible drop actions.
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos)
The QWheelEvent class contains parameters that describe a wheel event.
void setScreenPos(const QPoint &pos)
QRectF rect() const
Returns the rect for this touch point, relative to the widget or QGraphicsItem that received the even...
virtual QRectF boundingRect() const =0
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
void setMimeData(const QMimeData *data)
This function sets the MIME data for the event.
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...
static bool containsViewport(const QRect &r, int width, int height)
void setStartScenePos(const QPointF &startScenePos)
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, which is in paint device coordinates, using painter.
void setScenePos(const QPointF &pos)
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or 0 if no application wi...
void setAccepted(bool accepted)
void replayLastMouseEvent()
QBrush foregroundBrush() const
The QPointF class defines a point in the plane using floating point precision.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
void restore()
Restores the current painter state (pops a saved state off the stack).
void setDropAction(Qt::DropAction action)
Sets the action to be performed on the data by the target.
Qt::DropAction dropAction() const
Returns the action to be performed on the data by the target.
QPointF mapToScene(const QPointF &point) const
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
void dragEnterEvent(QDragEnterEvent *event)
Reimplemented Function
quint32 sceneInteractionAllowed
QPainter::RenderHints renderHints() const
QMouseEvent lastMouseEvent
QPointF topLeft() const
Returns the position of the rectangle's top-left corner.
int left() const
Returns the x-coordinate of the rectangle's left edge.
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Qt::MouseButtons buttons() const
Returns a Qt::MouseButtons value indicating which buttons were pressed on the mouse when this mouse e...
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
int width() const
Returns the width of the rectangle.
void processPendingUpdates()
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QList< QGraphicsItem * > items() const
Returns a list of all items in the scene in descending stacking order.
void mouseDoubleClickEvent(QMouseEvent *event)
Reimplemented Function
QWidget * widget() const
Returns the widget where the event originated, or 0 if the event originates from another application...
int count(const T &t) const
Returns the number of occurrences of value in the list.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifiers that were pressed when the drag and drop event was created...
QRect boundingRect() const
Returns the bounding rectangle of this region.
QPointF bottomLeft() const
Returns the position of the rectangle's bottom-left corner.
void setButtons(Qt::MouseButtons buttons)
The QPolygon class provides a vector of points using integer precision.
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
void setScenePos(const QPointF &pos)
void setWidget(QWidget *widget)
Sets the widget related to this event.
QBrush backgroundBrush() const
int height() const
Returns the height of the rectangle.
void inputMethodEvent(QInputMethodEvent *event)
Reimplemented Function
int q_round_bound(qreal d)
void populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest, QDropEvent *source)
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QRectF toRectF() const
Returns the variant as a QRectF if the variant has type() Rect or RectF ; otherwise returns an invali...
DragMode dragMode() const
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
qint64 horizontalScroll() const
Returns the horizontal scroll value (the X value of the left edge of the viewport).
bool updateSceneSlotReimplementedChecked
Q_DECL_CONSTEXPR T qAbs(const T &t)
QRectF boundingRect() const
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty...
The QObject class is the base class of all Qt objects.
void invalidateScene(const QRectF &rect=QRectF(), QGraphicsScene::SceneLayers layers=QGraphicsScene::AllLayers)
Invalidates and schedules a redraw of layers inside rect.
QVector< QStyleOptionGraphicsItem > styleOptions
QRectF mapRectFromScene(const QRectF &rect) const
Qt::KeyboardModifiers keyboardModifiers() const
Returns the modifier keys that are pressed.
void focusOutEvent(QFocusEvent *event)
Reimplemented Function
QPainter::RenderHints renderHints
QPoint lastMouseMoveScreenPoint
virtual int devType() const
The QSizeF class defines the size of a two-dimensional object using floating point precision...
virtual QPainterPath shape() const
Returns the shape of this item as a QPainterPath in local coordinates.
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void setupViewport(QWidget *widget)
This slot is called by QAbstractScrollArea after setViewport() has been called.
void save()
Saves the current painter state (pushes the state onto a stack).
QGraphicsView::ViewportAnchor transformationAnchor
CacheMode cacheMode() const
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
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...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
qreal x() const
Returns the x-coordinate of this point.
void resize(int size)
Sets the size of the vector to size.
void setButtons(Qt::MouseButtons buttons)
QRectF boundingRect() const
Returns the bounding rectangle of this painter path as a rectangle with floating point precision...
QTransform viewportTransform() const
Returns a matrix that maps viewport coordinates to scene coordinates.
void resetTransform()
Resets the view transformation to the identity matrix.
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...
QCursor cursor() const
Returns the current cursor shape for the item.
static const QRectF boundingRect(const QPointF *points, int pointCount)
bool contains(const QPointF &p) const
Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false...
Qt::Alignment alignment() const
int key() const
Returns the code of the key that was pressed or released.
void keyReleaseEvent(QKeyEvent *event)
Reimplemented Function
int width() const
Returns the width.
static QWidget * activeModalWidget()
Returns the active modal widget.
QWidget * source() const
This function returns the QGraphicsView that created the QGraphicsSceneDragDropEvent.
void setScene(QGraphicsScene *scene)
Sets the current scene to scene.
bool isInteractive() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal & rx()
Returns a reference to the x coordinate of this point.
The QGestureEvent class provides the description of triggered gestures.
The QRectF class defines a rectangle in the plane using floating point precision. ...
static bool intersectsViewport(const QRect &r, int width, int height)
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene's current focus item, or 0 if no item curr...
void setTransform(const QTransform &matrix, bool combine=false)
Sets the view's current transformation matrix to matrix.
void updateInputMethodSensitivity()
Enables input methods for the view if and only if the current focus item of the scene accepts input m...
void dragLeaveEvent(QDragLeaveEvent *event)
Reimplemented Function
quint32 fullUpdatePending
void setPossibleActions(Qt::DropActions actions)
Sets the possible drop actions that the drag can result in to actions.
QGraphicsView::ViewportUpdateMode viewportUpdateMode
void resizeEvent(QResizeEvent *event)
Reimplemented Function
void setScreenPos(const QPoint &pos)
Sets the position associated with the context menu to the given point in screen coordinates.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
QPointF lastPos() const
Returns the position of this touch point from the previous touch event, relative to the widget or QGr...
void setDropAction(Qt::DropAction action)
This function lets the receiver of the drop set the drop action that was performed to action...
void freeStyleOptionsArray(QStyleOptionGraphicsItem *array)
bool itemIsUntransformable() const
void initFrom(const QWidget *w)
void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems=false) const
static void QRect_unite(QRect *rect, const QRect &other)
void resetCachedContent()
Resets any cached content.
quint32 sceneTransformTranslateOnly
qreal height() const
Returns the height of the rectangle.
QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false...
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
bool spontaneous() const
Returns true if the event originated outside the application (a system event); otherwise returns fals...
The QPolygonF class provides a vector of points using floating point precision.
void dragMoveEvent(QDragMoveEvent *event)
Reimplemented Function
static const int QGRAPHICSVIEW_REGION_RECT_THRESHOLD
The QResizeEvent class contains event parameters for resize events.
QRegion mapToViewRegion(const QGraphicsItem *item, const QRectF &rect) const
const char * styleHint(const QFontDef &request)
QGraphicsItem * itemAt(const QPoint &pos) const
Returns the item at position pos, which is in viewport coordinates.
QPoint screenPos() const
Returns the position of the mouse relative to the screen.
Q_CORE_EXPORT void qWarning(const char *,...)
int delta() const
Returns the distance that the wheel is rotated, in eighths of a degree.
void _q_setViewportCursor(const QCursor &cursor)
void setUpdateClip(QGraphicsItem *)
QRectF mapRectToScene(const QRect &rect) const
void mouseMoveEventHandler(QMouseEvent *event)
Qt::MouseButtons buttons() const
Returns the mouse state when the event occurred.
void setSceneRect(const QRectF &sceneRect)
RenderHint
Renderhints are used to specify flags to QPainter that may or may not be respected by any given engin...
void translate(qreal dx, qreal dy)
Translates the current view transformation by (dx, dy).
qreal width() const
Returns the width of the rectangle.
QTransform transform() const
Returns the current transformation matrix for the view.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QRectF sceneRect
the scene rectangle; the bounding rectangle of the scene
void setRect(qreal x, qreal y, qreal w, qreal h)
Sets the coordinates of the rectangle's top-left corner to (x, y), and its size to the given width an...
The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leav...
quint32 keepLastCenterPoint
The QRegion class specifies a clip region for a painter.
static int startDragDistance()
void showEvent(QShowEvent *event)
Reimplemented Function
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 setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
The QShowEvent class provides an event that is sent when a widget is shown.
bool opaque
whether the rubber band is required to be drawn in an opaque style
void setOptimizationFlag(OptimizationFlag flag, bool enabled=true)
Enables flag if enabled is true; otherwise disables flag.
Qt::DropAction proposedAction() const
Returns the proposed drop action.
Qt::Orientation orientation() const
Returns the wheel's orientation.
The QStyleOptionRubberBand class is used to describe the parameters needed for drawing a rubber band...
void setLastScenePos(const QPointF &pos)
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...
void translate(qreal dx, qreal dy)
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position...
Qt::MouseButton button() const
Returns the button that caused the event.
void setInteractive(bool allowed)
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Q_AUTOTEST_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion)
void scrollContentsBy(int dx, int dy)
Reimplemented Function
QGraphicsView(QWidget *parent=0)
Constructs a QGraphicsView.
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
const T & at(int i) const
Returns the item at index position i in the vector.
void shear(qreal sh, qreal sv)
Shears the current view transformation by (sh, sv).
void setBackgroundBrush(const QBrush &brush)
The QMouseEvent class contains parameters that describe a mouse event.
Qt::DropAction proposedAction() const
Returns the drop action that is proposed, i.e., preferred.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
QTransform deviceTransform(const QTransform &viewportTransform) const
Returns this item's device transformation matrix, using viewportTransform to map from scene to device...
const QPoint & pos() const
Returns the position of the mouse cursor relative to the widget that received the event...
T & first()
Returns a reference to the first item in the list.
void setMatrix(const QMatrix &matrix, bool combine=false)
Sets the view's current transformation matrix to matrix.
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
void setRenderHints(RenderHints hints, bool on=true)
Sets the given render hints on the painter if on is true; otherwise clears the render hints...
The QBrush class defines the fill pattern of shapes drawn by QPainter.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
QPoint center() const
Returns the center point of the rectangle.
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode)
void setInputMethodHints(Qt::InputMethodHints hints)
Sets the current input method hints of this item to hints.
QPoint mapFromScene(const QPointF &point) const
Returns the scene coordinate point to viewport coordinates.
bool hasStoredOriginalCursor
Qt::DropActions possibleActions() const
Returns the possible drop actions that the drag and drop can result in.
QList< QGraphicsItem * > findItems(const QRegion &exposedRegion, bool *allItems, const QTransform &viewTransform) const
Adjustments in findItems: mapToScene(QRect) forces us to adjust theinput rectangle by (0...
QTransform sceneTransform
Qt::ItemSelectionMode rubberBandSelectionMode() const
void mouseMoveEvent(QMouseEvent *event)
Reimplemented Function
bool hasCursor() const
Returns true if this item has a cursor set; otherwise, false is returned.
The QStyleHintReturnMask class provides style hints that return a QRegion.
quint32 useLastMouseEvent
The QGraphicsSceneHelpEvent class provides events when a tooltip is requested.
int top() const
Returns the y-coordinate of the rectangle's top edge.
bool event(QEvent *event)
Reimplemented Function
qreal angle(const QPointF &p1, const QPointF &p2)
Qt::MouseButtons mouseButtons() const
Returns the mouse buttons that are pressed.
void setLastScenePos(const QPointF &lastScenePos)
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
void recalculateContentSize()
static QWidget * activePopupWidget()
Returns the active popup widget.
QRegion boundingRegion(const QTransform &itemToDeviceTransform) const
Returns the bounding region for this item.
void scale(qreal sx, qreal sy)
Scales the current view transformation by (sx, sy).
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
void setScreenPos(const QPoint &pos)
int right() const
Returns the x-coordinate of the rectangle's right edge.
const QTransform & worldTransform() const
Returns the world transformation matrix.
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setSceneRect(const QRectF &rect)
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
virtual void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[])
Draws the items items in the scene using painter, after the background and before the foreground are ...
QPointF scenePos() const
Returns the mouse cursor position in scene coordinates.
QSizeF boundedTo(const QSizeF &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
QRect toRect() const
Returns the variant as a QRect if the variant has type() Rect ; otherwise returns an invalid QRect...
static void translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent)
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
bool updateRegion(const QRectF &rect, const QTransform &xform)
Type type() const
Returns the storage type of the value stored in the variant.
bool updateRect(const QRect &rect)
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
QWidget * source() const
If the source of the drag operation is a widget in this application, this function returns that sourc...
QObject * parent() const
Returns a pointer to the parent object.
The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action ent...
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
const QList< QTouchEvent::TouchPoint > & touchPoints() const
Returns the list of touch points contained in the touch event.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
int size() const
Returns the number of items in the list.
void setModifiers(Qt::KeyboardModifiers modifiers)
Sets the keyboard modifiers that were pressed when the event was created to modifiers.
void setWidget(QWidget *widget)
Sets the widget for this event to the widget specified.
void updateSceneRect(const QRectF &rect)
Notifies QGraphicsView that the scene's scene rect has changed.
virtual void drawBackground(QPainter *painter, const QRectF &rect)
Draws the background of the scene using painter, before any items and the foreground are drawn...
bool viewportEvent(QEvent *event)
Reimplemented Function
int height() const
Returns the height.
const QPoint & globalPos() const
Returns the mouse cursor position when the event was generated in global coordinates.
The QRect class defines a rectangle in the plane using integer precision.
void _q_unsetViewportCursor()
#define Q_AUTOTEST_EXPORT
Qt::MouseButton mousePressButton
QPainterPath clipPath() const
Returns this item's clip path, or an empty QPainterPath if this item is not clipped.
QRubberBand::Shape shape
the shape of the rubber band
void setButtons(Qt::MouseButtons buttons)
Sets the mouse buttons that were pressed when the event was created to buttons.
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
const QPoint & globalPos() const
Returns the global position of the mouse pointer at the time of the event.
QRect mapToViewRect(const QGraphicsItem *item, const QRectF &rect) const
void setProposedAction(Qt::DropAction action)
Sets the proposed action to action.
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
void setForegroundBrush(const QBrush &brush)
QPointF scenePos() const
Returns the position of the mouse in scene coordinates.
qreal & ry()
Returns a reference to the y coordinate of this point.
int y() const
Returns the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
QGraphicsView::DragMode dragMode
The TouchPoint class provides information about a touch point in a QTouchEvent.
void setCacheMode(CacheMode mode)
QScopedPointer< QObjectData > d_ptr
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
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...
TransformData * transformData
QGraphicsView::OptimizationFlags optimizationFlags
void paintEvent(QPaintEvent *event)
Reimplemented Function
The QTouchEvent class contains parameters that describe a touch event.
QMap< QWidget *, QRect > paintedViewBoundingRects
const QMimeData * mimeData() const
Returns the data that was dropped on the widget and its associated MIME type information.
The QSize class defines the size of a two-dimensional object using integer point precision.
T * data()
Returns a pointer to the data stored in the vector.
void setWidget(QWidget *awidget)
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
quint32 mustResizeBackgroundPixmap
~QGraphicsView()
Destructs the QGraphicsView object.
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
void centerView(QGraphicsView::ViewportAnchor anchor)
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 reserve(int size)
Attempts to allocate memory for at least size elements.
int x() const
Returns the x coordinate of this point.
void setRenderHints(QPainter::RenderHints hints)
void setRenderHint(QPainter::RenderHint hint, bool enabled=true)
If enabled is true, the render hint hint is enabled; otherwise it is disabled.
qint64 verticalScroll() const
Returns the vertical scroll value (the X value of the top edge of the viewport).
QGraphicsSceneDragDropEvent * lastDragDropEvent
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
int capacity() const
Returns the maximum number of items that can be stored in the vector without forcing a reallocation...
QTouchEventSequence touchEvent(QWidget *widget=0, QTouchEvent::DeviceType deviceType=QTouchEvent::TouchScreen)
Creates and returns a QTouchEventSequence for the device deviceType to simulate events for widget...
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QList< QGraphicsItem * > items() const
Returns a list of all the items in the associated scene, in descending stacking order (i...
QRegion region
the region for style hints that return a QRegion
quint32 mustAllocateStyleOptions
void setLastScreenPos(const QPoint &pos)
QRectF translated(qreal dx, qreal dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
QPointF topRight() const
Returns the position of the rectangle's top-right corner.
void centerOn(const QPointF &pos)
Scrolls the contents of the viewport to ensure that the scene coordinate pos, is centered in the view...
void wheelEvent(QWheelEvent *event)
Reimplemented Function
The QPaintEvent class contains event parameters for paint events.
void setTouchPoints(const QList< QTouchEvent::TouchPoint > &atouchPoints)
Sets the list of touch points for this event.
ViewportUpdateMode viewportUpdateMode() const
void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos)
void setOptimizationFlags(OptimizationFlags flags)
void mouseReleaseEvent(QMouseEvent *event)
Reimplemented Function
QStyleOptionGraphicsItem * allocStyleOptionsArray(int numItems)
QPointer< QGraphicsScene > scene
void setButton(Qt::MouseButton button)
The QEvent class is the base class of all event classes.
QVariant inputMethodQuery(Qt::InputMethodQuery query) const
Reimplemented Function
Type type() const
Returns the event type.
void setViewportUpdateMode(ViewportUpdateMode mode)
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
QPointF center() const
Returns the center point of the rectangle.
void setDragMode(DragMode mode)
QGraphicsScene * scene() const
Returns a pointer to the scene that is currently visualized in the view.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void setOrientation(Qt::Orientation orientation)
void setScreenPos(const QPoint &pos)
Sets the mouse position relative to the screen to pos.
int size() const
Returns the number of items in the vector.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
QRectF sceneBoundingRect() const
Returns the bounding rect of this item in scene coordinates, by combining sceneTransform() with bound...
Qt::ItemSelectionMode rubberBandSelectionMode
QPointF lastMouseMoveScenePoint
QRect rect
the area that should be used for various calculations and painting
void resetMatrix()
Resets the view transformation matrix to the identity matrix.
The QFocusEvent class contains event parameters for widget focus events.
QPoint toPoint() const
Returns the variant as a QPoint if the variant has type() Point or PointF ; otherwise returns a null ...
quint32 accelerateScrolling
QGraphicsView::ViewportAnchor resizeAnchor
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
QMatrix inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
void mousePressEvent(QMouseEvent *event)
Reimplemented Function
const QPoint & pos() const
Returns the position where the drop was made.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Qt::MouseButtons buttons() const
Returns the combination of mouse buttons that were pressed at the time the event was sent...
ViewportAnchor transformationAnchor() const
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
QPointF startPos() const
Returns the starting position of this touch point, relative to the widget or QGraphicsItem that recei...
ViewportUpdateMode
This enum describes how QGraphicsView updates its viewport when the scene contents change or are expo...
void dropEvent(QDropEvent *event)
Reimplemented Function
ViewportAnchor
This enums describe the possible anchors that QGraphicsView can use when the user resizes the view or...
The QHelpEvent class provides an event that is used to request helpful information about a particular...
void setTransformationAnchor(ViewportAnchor anchor)
const QPoint & pos() const
Returns the mouse cursor position when the event was generated, relative to the widget to which the e...