183#include <QtCore/qdebug.h>
184#include <QtCore/qlist.h>
185#include <QtCore/qmath.h>
186#include <QtCore/qrect.h>
187#include <QtCore/qset.h>
188#include <QtCore/qstack.h>
189#include <QtCore/qtimer.h>
190#include <QtCore/qvarlengtharray.h>
191#include <QtCore/QMetaMethod>
192#include <QtWidgets/qapplication.h>
193#include <QtGui/qevent.h>
194#include <QtWidgets/qgraphicslayout.h>
195#include <QtWidgets/qgraphicsproxywidget.h>
196#include <QtWidgets/qgraphicswidget.h>
197#include <QtGui/qpaintengine.h>
198#include <QtGui/qpainter.h>
199#include <QtGui/qpainterpath.h>
200#include <QtGui/qpixmapcache.h>
201#include <QtGui/qpolygon.h>
202#include <QtGui/qpointingdevice.h>
203#include <QtWidgets/qstyleoption.h>
204#if QT_CONFIG(tooltip)
205#include <QtWidgets/qtooltip.h>
207#include <QtGui/qtransform.h>
208#include <QtGui/qinputmethod.h>
209#include <private/qapplication_p.h>
210#include <private/qevent_p.h>
211#include <QtGui/private/qeventpoint_p.h>
212#include <private/qobject_p.h>
213#if QT_CONFIG(graphicseffect)
214#include <private/qgraphicseffect_p.h>
216#include <private/qgesturemanager_p.h>
217#include <private/qpathclipper_p.h>
221# define DEBUG if (0) qDebug
251 dirtyGrowingItemsBoundingRect(true),
253 calledEmitUpdated(
false),
254 processDirtyItemsEmitted(
false),
255 needSortTopLevelItems(true),
256 holesInTopLevelSiblingIndex(
false),
257 topLevelSequentialOrdering(true),
258 scenePosDescendantsUpdatePending(
false),
261 lastMouseGrabberItemHasImplicitMouseGrab(
false),
262 allItemsIgnoreHoverEvents(true),
263 allItemsUseDefaultCursor(true),
264 painterStateProtection(true),
265 sortCacheEnabled(
false),
266 allItemsIgnoreTouchEvents(true),
268 minimumRenderSize(0.0),
269 selectionChanging(0),
277 activationRefCount(0),
278 childExplicitActivation(0),
282 lastDropAction(
Qt::IgnoreAction),
301 qApp->d_func()->scene_list.append(
q);
334 if (!
view->d_func()->connectedToScene) {
335 view->d_func()->connectedToScene =
true;
346 view->d_func()->processPendingUpdates();
349 view->d_func()->dispatchPendingUpdateRequests();
356 oldUpdatedRects <<
q->sceneRect();
361 std::back_inserter(oldUpdatedRects));
366 emit q->changed(oldUpdatedRects);
411 const QVariant booleanTrueVariant(
true);
416 for (
int i = 0;
i < oldUnpolishedCount; ++
i) {
467 if (wasPendingSceneUpdate)
471 view->d_func()->processPendingUpdates();
482 view->d_func()->dispatchPendingUpdateRequests();
493 p =
p->d_ptr->parent;
528 p =
p->d_ptr->parent;
583 widget->d_func()->fixFocusChainBeforeReparenting(
nullptr, oldScene,
nullptr);
591 if (parentItem->scene()) {
592 Q_ASSERT_X(parentItem->scene() ==
q,
"QGraphicsScene::removeItem",
593 "Parent item's scene is different from this item's scene");
646 if (unpolishedIndex != -1)
655 if (iterator.value() ==
item || iterator.key() ==
item)
683 emit q->selectionChanged();
685#ifndef QT_NO_GESTURES
712 qWarning(
"QGraphicsScene::setActivePanel: item %p must be part of this scene",
732 if (
fi ==
q->focusItem())
738 }
else if (
panel && !duringActivationEvent) {
740 const auto items =
q->items();
765 }
else if (
panel->isWidget()) {
772 fw = fw->d_func()->focusNext;
773 }
while (fw !=
panel);
775 }
else if (
q->isActive()) {
776 const auto items =
q->items();
800 bool emitFocusChanged)
817 if (emitFocusChanged)
857 if (emitFocusChanged)
906 widget->QGraphicsItem::d_ptr->setVisibleHelper(
false,
false);
921 qWarning(
"QGraphicsItem::grabMouse: already a mouse grabber");
927 qWarning(
"QGraphicsItem::grabMouse: already blocked by mouse grabber: %p",
961 qWarning(
"QGraphicsItem::ungrabMouse: not a mouse grabber");
1018 qWarning(
"QGraphicsItem::grabKeyboard: already a keyboard grabber");
1020 qWarning(
"QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p",
1046 qWarning(
"QGraphicsItem::ungrabKeyboard: not a keyboard grabber");
1084 view->viewport()->setMouseTracking(
true);
1100 if (!
view->isTransformed())
1117 for (
int i = 0x1;
i <= 0x10;
i <<= 1) {
1118 if (
event->buttons() &
i) {
1151 }
while (
it !=
end);
1184 if (
it.value()->sceneEventFilter(
it.key(),
event))
1202#if QT_CONFIG(gestures)
1205 if (gestureManager) {
1219 bool spont =
event->spontaneous();
1222 event->m_spont = spont;
1263 event.setWidget(hoverEvent->
widget());
1265 event.setPos(mapFromScene.
map(hoverEvent->
scenePos()));
1266 event.setScenePos(hoverEvent->
scenePos());
1267 event.setScreenPos(hoverEvent->
screenPos());
1271 event.setModifiers(hoverEvent->
modifiers());
1293 for (
int i = 0x1;
i <= 0x10;
i <<= 1) {
1299 mouseEvent->
setPos(itemPos);
1337 newActiveWindow = topItem ? topItem->
window() :
nullptr;
1340 if (newActiveWindow !=
q->activeWindow())
1341 q->setActiveWindow(newActiveWindow);
1344 bool setFocus =
false;
1368 bool sceneModality =
false;
1369 for (
auto modalPanel : std::as_const(
modalPanels)) {
1371 sceneModality =
true;
1412 mousePress.accept();
1413 mousePress.setButton(mouseEvent->
button());
1414 mousePress.setButtons(mouseEvent->
buttons());
1415 mousePress.setScreenPos(mouseEvent->
screenPos());
1416 mousePress.setScenePos(mouseEvent->
scenePos());
1417 mousePress.setModifiers(mouseEvent->
modifiers());
1418 mousePress.setWidget(mouseEvent->
widget());
1419 mousePress.setButtonDownPos(mouseEvent->
button(),
1421 mousePress.setButtonDownScenePos(mouseEvent->
button(),
1423 mousePress.setButtonDownScreenPos(mouseEvent->
button(),
1459 dontClearSelection |= extendSelection;
1460 if (!dontClearSelection) {
1464 q->clearSelection();
1534 const auto items =
q->items();
1591 const auto items =
q->items();
1657 qApp->d_func()->scene_list.removeAll(
this);
1663 const auto views =
d->views;
1665 view->setScene(
nullptr);
1686 if (
d->hasSceneRect)
1687 return d->sceneRect;
1689 if (
d->dirtyGrowingItemsBoundingRect) {
1698 return d->growingItemsBoundingRect;
1703 if (
rect !=
d->sceneRect) {
1704 d->hasSceneRect = !
rect.isNull();
1705 d->sceneRect =
rect;
1756 if (targetRect.
isNull()) {
1758 targetRect = sourceRect;
1768 switch (aspectRatioMode) {
1770 xratio = yratio =
qMin(xratio, yratio);
1773 xratio = yratio =
qMax(xratio, yratio);
1785 itemArray[numItems -
i - 1] = itemList.
at(
i);
1795 .
scale(xratio, yratio)
1802 itemArray[
i]->
d_ptr->initStyleOption(&styleOptionArray[
i], painterTransform, targetRect.
toRect());
1809 delete [] itemArray;
1810 delete [] styleOptionArray;
1834 return d->indexMethod;
1850 for (
int i = oldItems.
size() - 1;
i >= 0; --
i)
1851 d->index->addItem(oldItems.
at(
i));
1896 qWarning(
"QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0",
depth);
1902 qWarning(
"QGraphicsScene::setBspTreeDepth: cannot apply if indexing method is not BSP");
1919 const auto items_ =
items();
1934 return d->index->items(
order);
2071 qWarning(
"QGraphicsScene::collidingItems: cannot find collisions for null item");
2080 tmp << itemInVicinity;
2137 actuallySelectedSet <<
item;
2142 return d->selectedItems.values();
2155 return d->selectionArea;
2203 d->selectionArea =
path;
2208 ++
d->selectionChanging;
2222 switch (selectionOperation) {
2235 --
d->selectionChanging;
2237 if (!
d->selectionChanging &&
changed)
2251 ++
d->selectionChanging;
2260 stillSelectedSet <<
item;
2263 d->selectedItems = stillSelectedSet;
2266 --
d->selectionChanging;
2268 if (!
d->selectionChanging &&
changed)
2287 while (!
d->topLevelItems.isEmpty())
2288 delete d->topLevelItems.first();
2290 d->lastItemCount = 0;
2291 d->allItemsIgnoreHoverEvents =
true;
2292 d->allItemsUseDefaultCursor =
true;
2293 d->allItemsIgnoreTouchEvents =
true;
2294 d->focusOnTouch =
true;
2325 int commonIndex = -1;
2330 commonIndex =
index;
2335 if (commonIndex == -1) {
2336 commonAncestor =
nullptr;
2340 commonAncestor = ancestors.
at(commonIndex);
2346 if (!commonAncestor)
2398 qWarning(
"QGraphicsScene::addItem: cannot add null item");
2402 qWarning(
"QGraphicsScene::addItem: item has already been added to this scene");
2407 oldScene->removeItem(
item);
2412 QVariant::fromValue<QGraphicsScene *>(
this)));
2413 QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant);
2414 if (targetScene !=
this) {
2420 if (
d->unpolishedItems.isEmpty()) {
2424 d->unpolishedItems.append(
item);
2430 if (itemParent->d_ptr->scene !=
this)
2438 d->index->addItem(
item);
2442 d->registerTopLevelItem(
item);
2448 d->dirtyGrowingItemsBoundingRect =
true;
2451 ++
d->selectionChanging;
2452 int oldSelectedItemSize =
d->selectedItems.size();
2459 return item->acceptsHover
2463 if (
d->allItemsIgnoreHoverEvents && needsMouseTracking(
item->
d_ptr.
data())) {
2464 d->allItemsIgnoreHoverEvents =
false;
2465 d->enableMouseTrackingOnViews();
2469 d->allItemsUseDefaultCursor =
false;
2470 if (
d->allItemsIgnoreHoverEvents)
2471 d->enableMouseTrackingOnViews();
2477 d->allItemsIgnoreTouchEvents =
false;
2478 d->enableTouchEventsOnViews();
2481#ifndef QT_NO_GESTURES
2484 d->grabGesture(
item,
it.key());
2489 d->selectedItems <<
item;
2493 d->enterModal(
item);
2499 if (!
d->tabFocusFirst) {
2506 myNewPrev->d_func()->focusNext =
widget;
2507 widget->d_func()->focusPrev->d_func()->focusNext =
d->tabFocusFirst;
2508 d->tabFocusFirst->d_func()->focusPrev =
widget->d_func()->focusPrev;
2509 widget->d_func()->focusPrev = myNewPrev;
2524 --
d->selectionChanging;
2525 if (!
d->selectionChanging &&
d->selectedItems.size() != oldSelectedItemSize)
2532 bool autoActivate =
true;
2536 if (
d->childExplicitActivation == 1)
2539 autoActivate =
false;
2540 d->childExplicitActivation = 0;
2542 d->childExplicitActivation = 0;
2547 if (!
d->lastActivePanel && !
d->activePanel &&
item->
isPanel()) {
2551 d->lastActivePanel =
item;
2556 d->registerScenePosItem(
item);
2563 d->updateInputMethodSensitivityInViews();
2815 qWarning(
"QGraphicsScene::removeItem: cannot remove 0-item");
2819 qWarning(
"QGraphicsScene::removeItem: item %p's scene (%p)"
2820 " is different from this scene (%p)",
2828 QVariant::fromValue<QGraphicsScene *>(0)));
2829 QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant);
2830 if (targetScene !=
nullptr && targetScene !=
this) {
2835 d->removeItemHelper(
item);
2840 d->updateInputMethodSensitivityInViews();
2857 return isActive() ?
d->focusItem :
d->passiveFocusItem;
2882 d->setFocusItemHelper(
item, focusReason);
2930 d->hasFocus =
false;
2931 d->passiveFocusItem =
d->focusItem;
2962 return d->stickyFocus;
2990 return !
d->mouseGrabberItems.isEmpty() ?
d->mouseGrabberItems.last() : 0;
3012 return d->backgroundBrush;
3017 d->backgroundBrush =
brush;
3019 view->resetCachedContent();
3048 return d->foregroundBrush;
3053 d->foregroundBrush =
brush;
3054 const auto views_ =
views();
3076 if (
value.userType() == QMetaType::QRectF)
3078 else if (
value.userType() == QMetaType::QPointF)
3080 else if (
value.userType() == QMetaType::QRect)
3082 else if (
value.userType() == QMetaType::QPoint)
3096 if (
d->updateAll || (
rect.isEmpty() && !
rect.isNull()))
3101 bool directUpdates = !(
d->isSignalConnected(
d->changedSignalIndex)) && !
d->views.isEmpty();
3102 if (
rect.isNull()) {
3103 d->updateAll =
true;
3104 d->updatedRects.clear();
3105 if (directUpdates) {
3107 for (
auto view : std::as_const(
d->views))
3108 view->d_func()->fullUpdatePending =
true;
3111 if (directUpdates) {
3113 for (
auto view : std::as_const(
d->views)) {
3114 if (
view->isTransformed())
3115 view->d_func()->updateRectF(
view->viewportTransform().mapRect(
rect));
3120 d->updatedRects.insert(
rect);
3124 if (!
d->calledEmitUpdated) {
3125 d->calledEmitUpdated =
true;
3162 const auto views_ =
views();
3203 for (
int i = 0;
i < 2; ++
i) {
3204 const auto items_ =
items();
3235 switch (
event->type()) {
3253 d->cachedItemsUnderMouse.clear();
3258 switch (
event->type()) {
3275 if (!
d->focusItem) {
3301 if (
event->isAccepted())
3310 d->lastSceneMousePos = mouseEvent->
scenePos();
3337 d->lastSceneMousePos = hoverEvent->
scenePos();
3338 d->dispatchHoverEvent(hoverEvent);
3343 "QGraphicsScene must not receive QEvent::Leave, use GraphicsSceneLeave");
3348 d->leaveScene(leaveEvent->widget());
3358 if (!
d->activationRefCount++) {
3359 if (
d->lastActivePanel) {
3361 d->setActivePanelHelper(
d->lastActivePanel,
true);
3362 }
else if (
d->tabFocusFirst &&
d->tabFocusFirst->isPanel()) {
3365 d->setActivePanelHelper(
d->tabFocusFirst,
true);
3369 const auto items_ =
items();
3378 if (!--
d->activationRefCount) {
3379 if (
d->activePanel) {
3383 d->setActivePanelHelper(
nullptr,
true);
3384 d->lastActivePanel = lastActivePanel;
3388 const auto items_ =
items();
3407 d->resolvePalette();
3429#ifndef QT_NO_GESTURES
3449 if (watched !=
qApp)
3452 switch (
event->type()) {
3512 d->dragDropItem =
nullptr;
3531 if (!
d->mouseGrabberItems.isEmpty()) {
3533 d->clearMouseGrabber();
3534 d->mouseGrabberButtonDownPos.clear();
3535 d->mouseGrabberButtonDownScenePos.clear();
3536 d->mouseGrabberButtonDownScreenPos.clear();
3539 bool eventDelivered =
false;
3543 const auto items =
d->itemsAtPosition(
event->screenPos(),
3550 if (
item !=
d->dragDropItem) {
3554 d->cloneDragDropEvent(&dragEnter,
event);
3556 d->sendDragDropEvent(
item, &dragEnter);
3558 event->setDropAction(dragEnter.
dropAction());
3559 if (!
event->isAccepted()) {
3564 d->lastDropAction =
event->dropAction();
3566 if (
d->dragDropItem) {
3572 d->cloneDragDropEvent(&dragLeave,
event);
3573 d->sendDragDropEvent(
d->dragDropItem, &dragLeave);
3577 d->dragDropItem =
item;
3581 event->setDropAction(
d->lastDropAction);
3584 if (
event->isAccepted())
3585 d->lastDropAction =
event->dropAction();
3586 eventDelivered =
true;
3590 if (!eventDelivered) {
3591 if (
d->dragDropItem) {
3594 d->cloneDragDropEvent(&dragLeave,
event);
3595 d->sendDragDropEvent(
d->dragDropItem, &dragLeave);
3596 d->dragDropItem =
nullptr;
3613 if (
d->dragDropItem) {
3615 d->sendDragDropEvent(
d->dragDropItem,
event);
3616 d->dragDropItem =
nullptr;
3631 if (
d->dragDropItem) {
3633 d->sendDragDropEvent(
d->dragDropItem,
event);
3634 d->dragDropItem =
nullptr;
3652 switch (focusEvent->
reason()) {
3662 if (
d->passiveFocusItem) {
3682 d->hasFocus =
false;
3683 d->passiveFocusItem =
d->focusItem;
3687 if (!
d->popupWidgets.isEmpty())
3688 d->removePopup(
d->popupWidgets.constFirst());
3708#if !QT_CONFIG(tooltip)
3717 for (
auto item : itemsAtPos) {
3718 if (
item->d_func()->isProxyWidget()) {
3724 if (!
item->toolTip().isEmpty()) {
3733 if (toolTipItem && !toolTipItem->toolTip().isEmpty()) {
3734 text = toolTipItem->toolTip();
3785 commonAncestorItem = commonAncestorItem->
parentItem();
3786 if (commonAncestorItem && commonAncestorItem->
panel() !=
item->
panel()) {
3789 commonAncestorItem =
nullptr;
3839#if QT_CONFIG(tooltip)
3874 QGraphicsItem *
item = !
d->keyboardGrabberItems.isEmpty() ?
d->keyboardGrabberItems.constLast() : 0;
3884 if (
p->isBlockedByModalPanel())
3886 if (!
d->sendEvent(
p, keyEvent))
3888 }
while (!keyEvent->
isAccepted() && !
p->isPanel() && (
p =
p->parentItem()));
3906 QGraphicsItem *
item = !
d->keyboardGrabberItems.isEmpty() ?
d->keyboardGrabberItems.constLast() : 0;
3916 if (
p->isBlockedByModalPanel())
3918 if (!
d->sendEvent(
p, keyEvent))
3920 }
while (!keyEvent->
isAccepted() && !
p->isPanel() && (
p =
p->parentItem()));
3948 if (
d->mouseGrabberItems.isEmpty()) {
3952 d->dispatchHoverEvent(&hover);
3955 d->mousePressEventHandler(mouseEvent);
3973 if (
d->mouseGrabberItems.isEmpty()) {
3978 mouseEvent->
setAccepted(
d->dispatchHoverEvent(&hover));
3983 d->sendMouseEvent(mouseEvent);
4003 if (
d->mouseGrabberItems.isEmpty()) {
4009 d->sendMouseEvent(mouseEvent);
4014 if (!
d->mouseGrabberItems.isEmpty()) {
4015 d->lastMouseGrabberItem =
d->mouseGrabberItems.constLast();
4016 if (
d->lastMouseGrabberItemHasImplicitMouseGrab)
4017 d->mouseGrabberItems.constLast()->ungrabMouse();
4019 d->lastMouseGrabberItem =
nullptr;
4025 d->dispatchHoverEvent(&hoverEvent);
4051 d->mousePressEventHandler(mouseEvent);
4078 while (
iter >
d->popupWidgets.constBegin() && !wheelCandidates.
isEmpty()) {
4080 if (wheelCandidates.
first() == *
iter || (*iter)->isAncestorOf(wheelCandidates.
first()))
4082 d->removePopup(*
iter);
4085 bool hasSetFocus =
false;
4121 d->sendEvent(
d->focusItem,
event);
4125 d->sendEvent(
d->lastFocusItem,
event);
4146 if (
d->painterStateProtection)
4150 if (
d->painterStateProtection)
4173 if (
d->painterStateProtection)
4177 if (
d->painterStateProtection)
4184 bool useWindowOpacity,
bool painterStateProtection)
4192 const qreal windowOpacity = (
proxy &&
proxy->widget() && useWindowOpacity)
4193 ?
proxy->widget()->windowOpacity() : 1.0;
4199 if (windowOpacity < 1.0)
4208 if (painterStateProtection)
4211 if (painterStateProtection)
4222 if (windowOpacity < 1.0)
4227 const QTransform &itemToPixmap, QPainter::RenderHints renderHints,
4242 pixmapPainter.
begin(&subPix);
4244 if (!pixmapExposed.
isEmpty()) {
4257 pixmapPainter.
end();
4265 pixmapPainter.
end();
4282 if (m11 == 0.0f && m22 == 0.0f) {
4283 if (m12 == 1.0f && m21 == -1.0f)
4285 else if (m12 == -1.0f && m21 == 1.0f)
4287 else if (m12 == -1.0f && m21 == -1.0f)
4289 else if (m12 == 1.0f && m21 == 1.0f)
4303 bool painterStateProtection)
4316 qreal newPainterOpacity = oldPainterOpacity;
4319 const qreal windowOpacity =
proxy->widget()->windowOpacity();
4320 if (windowOpacity < 1.0)
4321 newPainterOpacity *= windowOpacity;
4326 QRectF adjustedBrect(brect);
4338 pixmapKey = itemCache->
key;
4351 if (fixedCacheSize) {
4354 pixmapSize = br.
size();
4357 pixmapSize *= devicePixelRatio;
4361 QSize adjustSize(adjust*2, adjust*2);
4362 br.
adjust(-adjust / devicePixelRatio, -adjust / devicePixelRatio, adjust / devicePixelRatio, adjust / devicePixelRatio);
4363 if (
pix.
isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) !=
pix.
size())) {
4384 if (fixedCacheSize) {
4386 (pixmapSize.
height() / devicePixelRatio) / brect.
height());
4397 for (
const auto &
rect : std::as_const(itemCache->
exposed)) {
4398 exposedRect |=
rect;
4399 pixmapExposed += itemToPixmap.
mapRect(
rect).toAlignedRect();
4402 exposedRect = brect;
4422 if (newPainterOpacity != oldPainterOpacity) {
4445 QSize maximumCacheSize =
4447 if (!maximumCacheSize.
isEmpty()
4458 bool pixModified =
false;
4460 bool invertable =
true;
4465 bool allowPartialCacheExposure =
false;
4468 if (!simpleTransform) {
4474 }
else if (!viewRect.
isNull()) {
4486 if (allowPartialCacheExposure) {
4493 QPoint newCacheIndent(dx, dy);
4515 newPixPainter.
end();
4520 exposed -=
QRect(-diff,
pix.
size() / devicePixelRatio);
4521 scrollExposure = exposed;
4555 QRegion pixmapExposed = scrollExposure;
4557 for (
const auto &
rect : std::as_const(itemCache->
exposed))
4566 for (
const auto &
rect : std::as_const(itemCache->
exposed))
4569 for (
const QRect &
r : std::as_const(scrollExposure))
4595 if (newPainterOpacity != oldPainterOpacity) {
4619 exposedSceneRect = viewTransform->
inverted().
mapRect(exposedSceneRect);
4622 for (
const auto subTree : tli)
4638 if (!itemHasContents && !itemHasChildren)
4648 bool translateOnlyTransform =
false;
4649#define ENSURE_TRANSFORM_PTR \
4650 if (!transformPtr) { \
4651 Q_ASSERT(!itemIsUntransformable); \
4652 if (viewTransform) { \
4653 transform = item->d_ptr->sceneTransform; \
4654 transform *= *viewTransform; \
4655 transformPtr = &transform; \
4657 transformPtr = &item->d_ptr->sceneTransform; \
4658 translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; \
4664 bool wasDirtyParentSceneTransform =
false;
4666 if (itemIsUntransformable) {
4672 wasDirtyParentSceneTransform =
true;
4677 bool drawItem = itemHasContents && !itemIsFullyTransparent;
4681 QRectF preciseViewBoundingRect = translateOnlyTransform ? brect.
translated(transformPtr->
dx(), transformPtr->
dy())
4682 : transformPtr->
mapRect(brect);
4684 bool itemIsTooSmallToRender =
false;
4688 itemIsTooSmallToRender =
true;
4692 bool itemIsOutsideVisibleRect =
false;
4694 QRect viewBoundingRect = preciseViewBoundingRect.toAlignedRect();
4698 drawItem = exposedRegion ? exposedRegion->
intersects(viewBoundingRect)
4700 itemIsOutsideVisibleRect = !drawItem;
4703 if (itemIsTooSmallToRender || itemIsOutsideVisibleRect) {
4709 if (!itemHasChildren)
4711 if (itemClipsChildrenToShape) {
4712 if (wasDirtyParentSceneTransform)
4719 if (itemHasChildren && itemClipsChildrenToShape)
4722#if QT_CONFIG(graphicseffect)
4726 painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent);
4728 QGraphicsItemEffectSourcePrivate *sourced =
static_cast<QGraphicsItemEffectSourcePrivate *
>
4730 sourced->info = &
info;
4732 if (effectTransform)
4745 QRect effectRect = sourced->paddedEffectRect(
Qt::DeviceCoordinates, sourced->currentCachedMode(), sourceRect).toAlignedRect();
4747 sourced->setCachedOffset(effectRect.
topLeft());
4757 sourced->info =
nullptr;
4762 effectTransform, wasDirtyParentSceneTransform, drawItem);
4781 if (effectTransform)
4790 bool wasDirtyParentSceneTransform,
bool drawItem)
4797 bool setChildClip = itemClipsChildrenToShape;
4798 bool itemHasChildrenStackedBehind =
false;
4801 if (itemHasChildren) {
4802 if (itemClipsChildrenToShape)
4811 if (itemHasChildrenStackedBehind) {
4812 if (itemClipsChildrenToShape) {
4814 setChildClip =
false;
4820 if (wasDirtyParentSceneTransform)
4821 child->d_ptr->dirtySceneTransform = 1;
4837 ? *exposedRegion :
QRegion(), exposedRegion ==
nullptr);
4840 bool restorePainterClip =
false;
4842 if (!itemHasChildren || !itemClipsChildrenToShape) {
4845 if ((restorePainterClip = itemClipsToShape))
4847 }
else if (itemHasChildrenStackedBehind){
4850 if (itemClipsToShape) {
4856 setChildClip =
true;
4858 }
else if (itemClipsToShape) {
4863 setChildClip =
false;
4893 if (itemHasChildren) {
4899 if (wasDirtyParentSceneTransform)
4900 child->d_ptr->dirtySceneTransform = 1;
4907 if (itemClipsChildrenToShape)
4913 bool force,
bool ignoreOpacity,
bool removingItemFromScene,
4914 bool updateBoundingRect)
4930 if (
p->d_ptr->ignoreOpacity) {
4934 p =
p->d_ptr->parent;
4939 removingItemFromScene || invalidateChildren,
4954 const bool fullItemUpdate =
rect.isNull();
4955 if (!fullItemUpdate &&
rect.isEmpty())
4965 if (removingItemFromScene) {
4976 for (
auto view : std::as_const(
views)) {
4986 if (!hasNoContents) {
4993 invalidateChildren =
true;
4996 if (invalidateChildren) {
5006 if (!updateBoundingRect)
5011 const QRectF &
rect,
bool itemIsUntransformable)
5019 if (itemIsUntransformable) {
5021 if (!
item->hasBoundingRegionGranularity)
5026 if (
item->sceneTransformTranslateOnly &&
view->identityMatrix) {
5030 r.translate(dx -
view->horizontalScroll(), dy -
view->verticalScroll());
5031 return view->updateRectF(
r);
5035 if (!
item->hasBoundingRegionGranularity)
5042 if (!
item->hasBoundingRegionGranularity)
5048 qreal parentOpacity)
5067 if (!itemHasContents) {
5068 if (!itemHasChildren) {
5073 itemHasContents =
true;
5086 if (wasDirtyParentSceneTransform && !itemIsUntransformable) {
5092 if (itemIsFullyTransparent || !itemHasContents || dirtyAncestorContainsChildren) {
5097 if (itemIsFullyTransparent || !itemHasContents)
5125 if (!
rect.isEmpty())
5130 bool uninitializedDirtyRect =
true;
5132 for (
auto view : std::as_const(
views)) {
5140 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5146 if (!viewPrivate->
updateRect(paintedViewBoundingRect))
5147 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5154 && paintedViewBoundingRect.
x() == -1 && paintedViewBoundingRect.
y() == -1
5155 && paintedViewBoundingRect.
width() == -1 && paintedViewBoundingRect.
height() == -1) {
5159 if (uninitializedDirtyRect) {
5160 dirtyRect = itemBoundingRect;
5165 uninitializedDirtyRect =
false;
5173 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5187 const bool bypassUpdateClip = !itemHasContents && wasDirtyParentViewBoundingRects;
5188 if (itemClipsChildrenToShape && !bypassUpdateClip) {
5191 view->d_func()->setUpdateClip(
item);
5193 if (!dirtyAncestorContainsChildren) {
5195 && itemClipsChildrenToShape;
5201 if (wasDirtyParentSceneTransform)
5202 child->d_ptr->dirtySceneTransform = 1;
5203 if (wasDirtyParentViewBoundingRects)
5204 child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1;
5205 if (parentIgnoresVisible)
5206 child->d_ptr->ignoreVisible = 1;
5207 if (parentIgnoresOpacity)
5208 child->d_ptr->ignoreOpacity = 1;
5209 if (allChildrenDirty) {
5210 child->d_ptr->dirty = 1;
5211 child->d_ptr->fullUpdatePending = 1;
5212 child->d_ptr->dirtyChildren = 1;
5213 child->d_ptr->allChildrenDirty = 1;
5218 if (itemClipsChildrenToShape) {
5221 view->d_func()->setUpdateClip(
nullptr);
5223 }
else if (wasDirtyParentSceneTransform) {
5268 if (!
d->unpolishedItems.isEmpty())
5269 d->_q_polishItems();
5278 const quint32 oldRectAdjust =
d->rectAdjust;
5280 d->updateAll =
false;
5281 expose = &
view->d_func()->exposedRegion;
5290 for (
int i = 0;
i < numItems; ++
i) {
5293 topLevelItems <<
item;
5299 d->rectAdjust = oldRectAdjust;
5301 for (
auto topLevelItem : std::as_const(topLevelItems))
5302 topLevelItem->d_ptr->itemDiscovered = 0;
5331 if (
d->lastFocusItem && !
d->lastFocusItem->isWidget()) {
5337 if (
d->activePanel) {
5342 if (
d->activePanel->isWidget()) {
5350 fw =
next ? fw->d_func()->focusNext : fw->d_func()->focusPrev;
5351 }
while (fw !=
d->activePanel);
5355 if (!
item && !
d->tabFocusFirst) {
5363 widget =
next ?
d->tabFocusFirst :
d->tabFocusFirst->d_func()->focusPrev;
5366 widget =
next ? test->d_func()->focusNext : test->d_func()->focusPrev;
5387 }
while (
widget != widgetThatHadFocus);
5494 d->style->setParent(
this);
5501 const auto items_ =
items();
5545 d->setFont_helper(resolvedFont);
5582 d->setPalette_helper(resolvedPalette);
5596 return d->activationRefCount > 0;
5609 return d->activePanel;
5626 d->setActivePanelHelper(
item,
false);
5640 if (
d->activePanel &&
d->activePanel->isWindow())
5656 qWarning(
"QGraphicsScene::setActiveWindow: widget %p must be part of this scene",
5675 z =
qMax(
z, sibling->zValue());
5680 panel->setZValue(
z + litt);
5700 qWarning(
"QGraphicsScene::sendEvent: cannot send event to a null item");
5704 qWarning(
"QGraphicsScene::sendEvent: item %p's scene (%p)"
5705 " is different from this scene (%p)",
5746 return d->minimumRenderSize;
5751 d->minimumRenderSize = minSize;
5781 return d->focusOnTouch;
5793#ifndef QT_NO_GESTURES
5796 view->viewport()->grabGesture(
it.key());
5810 for (
int i = 0;
i < touchEvent->pointCount(); ++
i) {
5811 auto &pt = touchEvent->
point(
i);
5812 QMutableEventPoint::setPosition(pt, mapFromScene.
map(pt.scenePosition()));
5818 int closestTouchPointId = -1;
5822 if (closestTouchPointId == -1||
distance < closestDistance) {
5823 closestTouchPointId = touchPoint.id();
5827 return closestTouchPointId;
5835 const auto &touchPoints = sceneTouchEvent->
points();
5836 for (
const auto &touchPoint : touchPoints) {
5850 touchPoint.scenePosition(),
5881 StatesAndTouchPoints &statesAndTouchPoints = itemsNeedingEvents[
item];
5882 statesAndTouchPoints.first = QEventPoint::States(statesAndTouchPoints.first | touchPoint.state());
5883 statesAndTouchPoints.second.append(touchPoint);
5886 if (itemsNeedingEvents.
isEmpty()) {
5887 sceneTouchEvent->
ignore();
5891 bool ignoreSceneTouchEvent =
true;
5901 switch (
it.value().first) {
5920 touchEvent.setTarget(sceneTouchEvent->
target());
5921 touchEvent.setModifiers(sceneTouchEvent->
modifiers());
5922 touchEvent.setTimestamp(sceneTouchEvent->
timestamp());
5924 switch (touchEvent.type()) {
5933 const auto &unhandledTouchPoints = touchEvent.
points();
5934 for (
const auto &touchPoint : unhandledTouchPoints) {
5938 ignoreSceneTouchEvent =
false;
5946 ignoreSceneTouchEvent =
false;
5952 sceneTouchEvent->QInputEvent::setAccepted(ignoreSceneTouchEvent);
5964 static_cast<QWidget *
>(touchEvent->target()));
5968 bool setFocus =
false;
5996 bool eventAccepted = touchEvent->isAccepted();
6001 touchEvent->setAccepted(acceptTouchEvents);
6003 eventAccepted = touchEvent->isAccepted();
6010 touchEvent->m_spont =
false;
6011 if (
res && eventAccepted) {
6013 const auto &touchPoints = touchEvent->
points();
6014 for (
const auto &touchPoint : touchPoints)
6023 touchEvent->QInputEvent::setAccepted(eventAccepted);
6036 view->d_func()->updateInputMethodSensitivity();
6048 panel->
d_ptr->panelModality = previousModality;
6053 const auto items_ =
q->items();
6054 for (
const auto &
item : items_) {
6085 const auto items_ =
q->items();
6086 for (
const auto &
item : items_) {
6107 const auto items_ =
q->items();
6108 for (
const auto &
item : items_) {
6118 const auto items_ =
q->items();
6119 for (
const auto &
item : items_) {
6131#ifndef QT_NO_GESTURES
6140 for (
QGesture *gesture : gestures) {
6141 if (!gesture->hasHotSpot())
6155 d->gestureContext.constFind(gestureType);
6156 if (
it !=
d->gestureContext.constEnd() && (!flag || (
it.value() & flag))) {
6157 if (normalGestures.
contains(gesture)) {
6158 normalGestures.
remove(gesture);
6160 conflicts->
insert(gesture);
6162 normalGestures.
insert(gesture);
6165 (*targets)[itemobj].insert(gesture);
6167 (*itemsSet).insert(itemobj);
6176 *normal = normalGestures;
6189 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6190 <<
"Gestures:" << allGestures;
6196 for (
QGesture *gesture : allGestures) {
6198 if (gesture->hasHotSpot()) {
6199 gesture->d_func()->sceneHotSpot = toScene.
map(gesture->hotSpot());
6201 gesture->d_func()->sceneHotSpot =
QPointF();
6209 startedGestures.
insert(gesture);
6213 if (!startedGestures.
isEmpty()) {
6217 &normalGestures, &conflictedGestures);
6220 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6221 <<
"Normal gestures:" << normalGestures
6222 <<
"Conflicting gestures:" << conflictedGestures;
6226 if (!conflictedGestures.
isEmpty()) {
6235 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6236 <<
"delivering override to"
6257 for(;
it !=
e; ++
it)
6261 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6262 <<
"override was accepted:"
6272 if (conflictedGestures.
isEmpty())
6278 if (!normalGestures.
isEmpty()) {
6298 for (
QGesture *gesture : allGestures) {
6302 undeliveredGestures.
insert(gesture);
6304 const Qt::GestureFlags
flags =
d->gestureContext.value(gesture->gestureType());
6306 parentPropagatedGestures.
insert(gesture);
6308 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6309 <<
"no target for" << gesture <<
"at"
6310 << gesture->hotSpot() << gesture->d_func()->sceneHotSpot;
6324 const bool isPanel = receiver.
data()->isPanel();
6326 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6328 << receiver.
data() << gestures;
6348 undeliveredGestures.
remove(
g);
6351 if (undeliveredGestures.
isEmpty())
6356 if (!ignoredGestures.
isEmpty() && !isPanel) {
6365 it != ignoredGestures.
end();) {
6366 if (parentPropagatedGestures.
contains(*
it)) {
6372 if (
item->d_func()->gestureContext.
contains(gestureType)) {
6394 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6401 for (
QGesture *
g : std::as_const(startedGestures)) {
6403 DEBUG() <<
"lets try to cancel some";
6411 switch (
g->state()) {
6430 if (originalItem ==
nullptr)
6442 DEBUG() <<
" found a gesture to cancel" <<
iter.key();
6444 canceledGestures <<
iter.key();
6452 while (!almostCanceledGestures.
isEmpty()) {
6455 setIter = almostCanceledGestures.
begin();
6457 while (setIter != almostCanceledGestures.
end()) {
6462 gestures << *setIter;
6463 setIter = almostCanceledGestures.
erase(setIter);
6480 if (!
g->hasHotSpot())
6489 if (
d->gestureContext.contains(
g->gestureType())) {
6504 for (setIter = canceledGestures.
begin(); setIter != canceledGestures.
end(); ++setIter) {
6505 gestureManager->
recycle(*setIter);
6515 view->viewport()->grabGesture(gesture);
6527 view->viewport()->ungrabGesture(gesture);
6534#include "moc_qgraphicsscene.cpp"
static QApplicationPrivate * instance()
QGestureManager * gestureManager
static QStyle * style()
Returns the application's style object.
static QFont font()
Returns the default application font.
The QColor class provides colors based on RGB, HSV or CMYK values.
static QColor fromHsv(int h, int s, int v, int a=255)
Static convenience function that returns a QColor constructed from the HSV color values,...
static bool is_app_closing
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
The QEventPoint class provides information about a point in a QPointerEvent.
QPointF globalPosition
the global position of this point.
int id
the ID number of this event point.
QPointF scenePosition
the scene position of this point.
virtual void setAccepted(bool accepted)
bool spontaneous() const
Returns true if the event originated outside the application (a system event); otherwise returns fals...
Type
This enum type defines the valid event types in Qt.
@ ApplicationPaletteChange
@ GraphicsSceneContextMenu
@ GraphicsSceneMouseRelease
@ GraphicsSceneMousePress
@ GraphicsSceneHoverLeave
@ GraphicsSceneMouseDoubleClick
@ GraphicsSceneHoverEnter
Type type() const
Returns the event type.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
The QFocusEvent class contains event parameters for widget focus events.
Qt::FocusReason reason() const
Returns the reason for this focus event.
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
void setResolveMask(uint mask)
The QGestureEvent class provides the description of triggered gestures.
void setWidget(QWidget *widget)
bool isAccepted(QGesture *) const
Returns true if the gesture is accepted; otherwise returns false.
void ignore(QGesture *)
Clears the accept flag parameter of the given gesture object, the equivalent of calling \l{QGestureEv...
void setAccepted(QGesture *, bool)
Sets the accept flag of the given gesture object to the specified value.
void recycle(QGesture *gesture)
bool filterEvent(QWidget *receiver, QEvent *event)
static QGestureManager * instance(InstanceCreation ic=ForceCreation)
void cleanupCachedGestures(QObject *target, Qt::GestureType type)
The QGesture class represents a gesture, containing properties that describe the corresponding user i...
Qt::GestureType gestureType
the type of the gesture
The QGraphicsEffectSource class represents the source on which a QGraphicsEffect is installed on.
QGraphicsEffectSource * source() const
virtual void draw(QPainter *painter)=0
This pure virtual function draws the effect and is called whenever the source needs to be drawn.
The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene.
QHash< QPaintDevice *, DeviceData > deviceData
The QGraphicsItemGroup class provides a container that treats a group of items as a single item.
bool isOpacityNull() const
void invalidateChildrenSceneTransform()
QVariant extra(Extra type) const
quint32 dirtySceneTransform
static bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b)
void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems=false) const
QGraphicsEffect * graphicsEffect
@ ExtraMaxDeviceCoordCacheSize
void markParentDirty(bool updateBoundingRect=false)
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
bool itemIsUntransformable() const
bool discardUpdateRequest(bool ignoreVisibleBit=false, bool ignoreDirtyBit=false, bool ignoreOpacity=false) const
bool childrenCombineOpacity() const
void clearSubFocus(QGraphicsItem *rootItem=nullptr, QGraphicsItem *stopItem=nullptr)
QList< QGraphicsItem * > children
@ AncestorFiltersChildEvents
quint32 acceptedTouchBeginEvent
quint32 sceneTransformTranslateOnly
quint32 scenePosDescendants
quint32 acceptTouchEvents
QPointF genericMapFromScene(const QPointF &pos, const QWidget *viewport) const
virtual void updateSceneTransformFromParent()
QTransform genericMapFromSceneTransform(const QWidget *viewport=nullptr) const
quint32 paintedViewBoundingRectsNeedRepaint
virtual void resolvePalette(uint inheritedMask)
QTransform sceneTransform
QHash< QWidget *, QRect > paintedViewBoundingRects
QGraphicsItemCache * extraItemCache() const
virtual void resolveFont(uint inheritedMask)
qreal combineOpacityFromParent(qreal parentOpacity) const
void ensureSortedChildren()
quint32 fullUpdatePending
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
virtual bool contains(const QPointF &point) const
Returns true if this item contains point, which is in local coordinates; otherwise,...
QTransform deviceTransform(const QTransform &viewportTransform) const
void setSelected(bool selected)
If selected is true and this item is selectable, this item is selected; otherwise,...
bool acceptDrops() const
Returns true if this item can accept drag and drop events; otherwise, returns false.
QScopedPointer< QGraphicsItemPrivate > d_ptr
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
This virtual function is called by QGraphicsItem to notify custom items that some part of the item's ...
qreal boundingRegionGranularity() const
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)=0
This function, which is usually called by QGraphicsView, paints the contents of an item in local coor...
void clearFocus()
Takes keyboard input focus from the item.
QGraphicsScene * scene() const
Returns the current scene for the item, or \nullptr if the item is not stored in a scene.
bool isSelected() const
Returns true if this item is selected; otherwise, false is returned.
virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
Returns true if this item collides with other; otherwise returns false.
virtual QPainterPath shape() const
Returns the shape of this item as a QPainterPath in local coordinates.
@ ItemClipsChildrenToShape
@ ItemContainsChildrenInShape
@ ItemSendsScenePositionChanges
@ ItemIgnoresParentOpacity
@ ItemStopsClickFocusPropagation
QGraphicsWidget * window() const
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 ...
bool isEnabled() const
Returns true if the item is enabled; otherwise, false is returned.
bool isBlockedByModalPanel(QGraphicsItem **blockingPanel=nullptr) const
QGraphicsObject * toGraphicsObject()
virtual void advance(int phase)
This virtual function is called twice for all items by the QGraphicsScene::advance() slot.
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
Qt::MouseButtons acceptedMouseButtons() const
Returns the mouse buttons that this item accepts mouse events for.
QVariant data(int key) const
Returns this item's custom data for the key key as a QVariant.
QGraphicsItem * panel() const
QGraphicsItem * parentItem() const
Returns a pointer to this item's parent item.
QTransform sceneTransform() const
QGraphicsItem * commonAncestorItem(const QGraphicsItem *other) const
bool isVisible() const
Returns true if the item is visible; otherwise, false is returned.
QGraphicsItem * focusItem() const
PanelModality panelModality() const
void setFocus(Qt::FocusReason focusReason=Qt::OtherFocusReason)
Gives keyboard input focus to this item.
GraphicsItemFlags flags() const
Returns this item's flags.
virtual bool sceneEvent(QEvent *event)
This virtual function receives events to this item.
bool acceptTouchEvents() const
bool isAncestorOf(const QGraphicsItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child's parent,...
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
The QGraphicsObject class provides a base class for all graphics items that require signals,...
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene.
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for disco...
void setBspTreeDepth(int depth)
int bspTreeDepth
the depth of the BSP index tree
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)
Qt::DropAction dropAction() const
Returns the action that was performed in this drag and drop.
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 setPos(const QPointF &pos)
void setScenePos(const QPointF &pos)
QPointF scenePos() const
Returns the position of the mouse in scene coordinates.
The QGraphicsSceneEvent class provides a base class for all graphics view related events.
void setWidget(QWidget *widget)
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.
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
void setScreenPos(const QPoint &pos)
void setPos(const QPointF &pos)
QPoint lastScreenPos() const
void setLastPos(const QPointF &pos)
QPoint screenPos() const
Returns the position of the mouse cursor in screen coordinates at the moment the hover event was sent...
void setScenePos(const QPointF &pos)
QPointF scenePos() const
Returns the position of the mouse cursor in scene coordinates at the moment the hover event was sent.
void setModifiers(Qt::KeyboardModifiers modifiers)
QPointF lastScenePos() const
void setLastScenePos(const QPointF &pos)
void setLastScreenPos(const QPoint &pos)
Qt::KeyboardModifiers modifiers() const
The QGraphicsSceneLinearIndex class provides an implementation of a linear indexing algorithm for dis...
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
Qt::MouseButton button() const
Returns the mouse button (if any) that caused the event.
QPointF pos() const
Returns the mouse cursor position in item coordinates.
void setButtonDownPos(Qt::MouseButton button, const QPointF &pos)
QPointF lastScenePos() const
Returns the last recorded mouse cursor position in scene coordinates.
QPointF buttonDownScenePos(Qt::MouseButton button) const
Returns the mouse cursor position in scene coordinates where the specified button was clicked.
QPoint buttonDownScreenPos(Qt::MouseButton button) const
Returns the mouse cursor position in screen coordinates where the specified button was clicked.
void setLastPos(const QPointF &pos)
QPoint lastScreenPos() const
Returns the last recorded mouse cursor position in screen coordinates.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifiers in use at the time the event was sent.
QPoint screenPos() const
Returns the mouse cursor position in screen coordinates.
void setPos(const QPointF &pos)
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)
QPointF lastPos() const
Returns the last recorded mouse cursor position in item coordinates.
QPointF scenePos() const
Returns the mouse cursor position in scene coordinates.
void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos)
QPointF buttonDownPos(Qt::MouseButton button) const
Returns the mouse cursor position in item coordinates where the specified button was clicked.
QList< QGraphicsItem * > cachedItemsUnderMouse
QMultiMap< QGraphicsItem *, QGraphicsItem * > sceneEventFilters
QList< QGraphicsView * > views
QHash< QGraphicsObject *, QSet< QGesture * > > cachedItemGestures
void removeSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter)
void setScenePosItemEnabled(QGraphicsItem *item, bool enabled)
void addView(QGraphicsView *view)
void resetDirtyItem(QGraphicsItem *item, bool recursive=false)
QList< QGraphicsItem * > itemsAtPosition(const QPoint &screenPos, const QPointF &scenePos, QWidget *widget) const
Returns all items for the screen position in event.
void registerScenePosItem(QGraphicsItem *item)
quint32 allItemsIgnoreHoverEvents
QHash< QGesture *, QGraphicsObject * > gestureTargets
QList< QGraphicsItem * > modalPanels
QList< QGraphicsItem * > mouseGrabberItems
QPointF lastSceneMousePos
void gestureEventHandler(QGestureEvent *event)
QHash< QGraphicsObject *, QSet< QGesture * > > cachedAlreadyDeliveredGestures
QSet< QGraphicsItem * > scenePosItems
int findClosestTouchPointId(const QPointF &scenePos)
void leaveModal(QGraphicsItem *item)
QGraphicsItem * lastFocusItem
QList< QGraphicsWidget * > popupWidgets
quint32 topLevelSequentialOrdering
void ungrabMouse(QGraphicsItem *item, bool itemIsDying=false)
QStyleOptionGraphicsItem styleOptionTmp
bool sendEvent(QGraphicsItem *item, QEvent *event)
QMap< int, QEventPoint > sceneCurrentTouchPoints
void grabMouse(QGraphicsItem *item, bool implicit=false)
void addPopup(QGraphicsWidget *widget)
quint32 dirtyGrowingItemsBoundingRect
void markDirty(QGraphicsItem *item, const QRectF &rect=QRectF(), bool invalidateChildren=false, bool force=false, bool ignoreOpacity=false, bool removingItemFromScene=false, bool updateBoundingRect=false)
QList< QGraphicsItem * > unpolishedItems
static void updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent)
void clearKeyboardGrabber()
void gestureTargetsAtHotSpots(const QSet< QGesture * > &gestures, Qt::GestureFlag flag, QHash< QGraphicsObject *, QSet< QGesture * > > *targets, QSet< QGraphicsObject * > *itemsSet=nullptr, QSet< QGesture * > *normal=nullptr, QSet< QGesture * > *conflicts=nullptr)
void removeView(QGraphicsView *view)
QMap< Qt::MouseButton, QPoint > mouseGrabberButtonDownScreenPos
QGraphicsWidget * tabFocusFirst
void ungrabGesture(QGraphicsItem *, Qt::GestureType gesture)
quint32 painterStateProtection
QHash< Qt::GestureType, int > grabbedGestures
void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent)
QSet< QGraphicsItem * > selectedItems
void ungrabKeyboard(QGraphicsItem *item, bool itemIsDying=false)
void enableTouchEventsOnViews()
void grabKeyboard(QGraphicsItem *item)
void installSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter)
void updateFont(const QFont &font)
bool filterDescendantEvent(QGraphicsItem *item, QEvent *event)
void touchEventHandler(QTouchEvent *touchEvent)
QGraphicsItem * passiveFocusItem
QList< QGraphicsObject * > cachedTargetItems
QGraphicsItem * activePanel
void drawItems(QPainter *painter, const QTransform *const viewTransform, QRegion *exposedRegion, QWidget *widget)
quint32 calledEmitUpdated
void updatePalette(const QPalette &palette)
quint32 needSortTopLevelItems
static QGraphicsScenePrivate * get(QGraphicsScene *q)
QList< QGraphicsItem * > hoverItems
void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason, bool emitFocusChanged=true)
void enableMouseTrackingOnViews()
void drawItemHelper(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, bool painterStateProtection)
bool sendTouchBeginEvent(QGraphicsItem *item, QTouchEvent *touchEvent)
QGraphicsItem * focusItem
void drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, const QTransform *const, QRegion *exposedRegion, QWidget *widget, qreal parentOpacity=qreal(1.0), const QTransform *const effectTransform=nullptr)
void _q_updateScenePosDescendants()
void setFont_helper(const QFont &font)
void unregisterTopLevelItem(QGraphicsItem *item)
void cancelGesturesForChildren(QGesture *original)
void _q_processDirtyItems()
void sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent)
void enterModal(QGraphicsItem *item, QGraphicsItem::PanelModality panelModality=QGraphicsItem::NonModal)
void registerTopLevelItem(QGraphicsItem *item)
std::set< QRectF, UpdatedRectsCmp > updatedRects
QGraphicsItem * lastMouseGrabberItem
void leaveScene(QWidget *viewport)
bool dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEvent)
This event handler, for event hoverEvent, can be reimplemented in a subclass to receive hover enter e...
QGraphicsScene::ItemIndexMethod indexMethod
quint32 processDirtyItemsEmitted
bool itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const
void grabGesture(QGraphicsItem *, Qt::GestureType gesture)
quint32 scenePosDescendantsUpdatePending
QGraphicsItem * lastActivePanel
bool filterEvent(QGraphicsItem *item, QEvent *event)
QMap< Qt::MouseButton, QPointF > mouseGrabberButtonDownScenePos
void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren=false, qreal parentOpacity=qreal(1.0))
QGraphicsSceneIndex * index
QGraphicsItem * dragDropItem
void updateInputMethodSensitivityInViews()
QMap< int, QGraphicsItem * > itemForTouchPointId
void unregisterScenePosItem(QGraphicsItem *item)
void removeItemHelper(QGraphicsItem *item)
QList< QGraphicsItem * > keyboardGrabberItems
void sendHoverEvent(QEvent::Type type, QGraphicsItem *item, QGraphicsSceneHoverEvent *hoverEvent)
quint32 holesInTopLevelSiblingIndex
void draw(QGraphicsItem *, QPainter *, const QTransform *const, const QTransform *const, QRegion *, QWidget *, qreal, const QTransform *const, bool, bool)
void setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent)
void cloneDragDropEvent(QGraphicsSceneDragDropEvent *dest, QGraphicsSceneDragDropEvent *source)
void storeMouseButtonsForMouseGrabber(QGraphicsSceneMouseEvent *event)
QRectF growingItemsBoundingRect
QMap< Qt::MouseButton, QPointF > mouseGrabberButtonDownPos
quint32 lastMouseGrabberItemHasImplicitMouseGrab
void setPalette_helper(const QPalette &palette)
int processDirtyItemsIndex
void removePopup(QGraphicsWidget *widget, bool itemIsDying=false)
void ensureSequentialTopLevelSiblingIndexes()
QList< QGraphicsItem * > topLevelItems
void sendDragDropEvent(QGraphicsItem *item, QGraphicsSceneDragDropEvent *dragDropEvent)
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.
qreal minimumRenderSize
the minimal view-transformed size an item must have to be drawn
QList< QGraphicsItem * > items(Qt::SortOrder order=Qt::DescendingOrder) const
Returns an ordered list of all items on the scene.
void removeItem(QGraphicsItem *item)
Removes the item item and all its children from the scene.
void setFont(const QFont &font)
bool hasFocus() const
Returns true if the scene has focus; otherwise returns false.
void addItem(QGraphicsItem *item)
Adds or moves the item and all its children to this scene.
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drag move events f...
void changed(const QList< QRectF > ®ion)
This signal is emitted by QGraphicsScene when control reaches the event loop, if the scene content ch...
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse press e...
QGraphicsProxyWidget * addWidget(QWidget *widget, Qt::WindowFlags wFlags=Qt::WindowFlags())
Creates a new QGraphicsProxyWidget for widget, adds it to the scene, and returns a pointer to the pro...
void destroyItemGroup(QGraphicsItemGroup *group)
Reparents all items in group to group's parent item, then removes group from the scene,...
void clearSelection()
Clears the current selection.
virtual void helpEvent(QGraphicsSceneHelpEvent *event)
This event handler, for event helpEvent, can be reimplemented in a subclass to receive help events.
void setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason=Qt::OtherFocusReason)
Sets the scene's focus item to item, with the focus reason focusReason, after removing focus from any...
bool stickyFocus
whether clicking into the scene background will clear focus
virtual void dropEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drop events for th...
bool sendEvent(QGraphicsItem *item, QEvent *event)
virtual void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget=nullptr)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse move ev...
void setFocusOnTouch(bool enabled)
QGraphicsPathItem * addPath(const QPainterPath &path, const QPen &pen=QPen(), const QBrush &brush=QBrush())
Creates and adds a path item to the scene, and returns the item pointer.
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
This event handler, for event wheelEvent, can be reimplemented in a subclass to receive mouse wheel e...
void setBspTreeDepth(int depth)
QGraphicsEllipseItem * addEllipse(const QRectF &rect, const QPen &pen=QPen(), const QBrush &brush=QBrush())
Creates and adds an ellipse item to the scene, and returns the item pointer.
void setStickyFocus(bool enabled)
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drag leave events ...
void setActivePanel(QGraphicsItem *item)
virtual void focusInEvent(QFocusEvent *event)
This event handler, for event focusEvent, can be reimplemented in a subclass to receive focus in even...
void invalidate(const QRectF &rect=QRectF(), SceneLayers layers=AllLayers)
Invalidates and schedules a redraw of the layers in rect on the scene.
QList< QGraphicsItem * > selectedItems() const
Returns a list of all currently selected items.
QGraphicsScene(QObject *parent=nullptr)
Constructs a QGraphicsScene object.
bool eventFilter(QObject *watched, QEvent *event) override
\reimp
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse release...
QRectF sceneRect
the scene rectangle; the bounding rectangle of the scene
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 setForegroundBrush(const QBrush &brush)
void setStyle(QStyle *style)
QGraphicsItem * activePanel() const
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse double-...
void advance()
This slot advances the scene by one step, by calling QGraphicsItem::advance() for all items on the sc...
QBrush foregroundBrush
the foreground brush of the scene.
int bspTreeDepth
the depth of QGraphicsScene's BSP index tree
void setPalette(const QPalette &palette)
virtual ~QGraphicsScene()
Removes and deletes all items from the scene object before destroying the scene object.
QList< QGraphicsView * > views() const
Returns a list of all the views that display this scene.
QRectF itemsBoundingRect() const
Calculates and returns the bounding rect of all items on the scene.
void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform)
ItemIndexMethod itemIndexMethod
the item indexing method.
QGraphicsPixmapItem * addPixmap(const QPixmap &pixmap)
Creates and adds a pixmap item to the scene, and returns the item pointer.
QGraphicsPolygonItem * addPolygon(const QPolygonF &polygon, const QPen &pen=QPen(), const QBrush &brush=QBrush())
Creates and adds a polygon item to the scene, and returns the item pointer.
void setItemIndexMethod(ItemIndexMethod method)
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
This method is used by input methods to query a set of properties of the scene to be able to support ...
void setSceneRect(const QRectF &rect)
QGraphicsRectItem * addRect(const QRectF &rect, const QPen &pen=QPen(), const QBrush &brush=QBrush())
Creates and adds a rectangle item to the scene, and returns the item pointer.
void sceneRectChanged(const QRectF &rect)
This signal is emitted by QGraphicsScene whenever the scene rect changes.
QBrush backgroundBrush
the background brush of the scene.
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This event handler, for event contextMenuEvent, can be reimplemented in a subclass to receive context...
void update(const QRectF &rect=QRectF())
Schedules a redraw of the area rect on the scene.
virtual bool focusNextPrevChild(bool next)
bool focusOnTouch
whether items gain focus when receiving a {touch begin} event.
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drag enter events ...
QPalette palette
the scene's default palette
void setActiveWindow(QGraphicsWidget *widget)
QList< QGraphicsItem * > collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
Returns a list of all items that collide with item.
ItemIndexMethod
This enum describes the indexing algorithms QGraphicsScene provides for managing positional informati...
QPainterPath selectionArea() const
Returns the selection area that was previously set with setSelectionArea(), or an empty QPainterPath ...
QFont font
the scene's default font
QGraphicsItemGroup * createItemGroup(const QList< QGraphicsItem * > &items)
Groups all items in items into a new QGraphicsItemGroup, and returns a pointer to the group.
void clearFocus()
Clears focus from the scene.
QGraphicsWidget * activeWindow() const
virtual void keyPressEvent(QKeyEvent *event)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive keypress events...
QGraphicsLineItem * addLine(const QLineF &line, const QPen &pen=QPen())
Creates and adds a line item to the scene, and returns the item pointer.
friend class QGraphicsSceneBspTreeIndex
virtual void inputMethodEvent(QInputMethodEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive input method event...
void setBackgroundBrush(const QBrush &brush)
virtual void focusOutEvent(QFocusEvent *event)
This event handler, for event focusEvent, can be reimplemented in a subclass to receive focus out eve...
QGraphicsTextItem * addText(const QString &text, const QFont &font=QFont())
Creates and adds a text item to the scene, and returns the item pointer.
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive key release eve...
void setMinimumRenderSize(qreal minSize)
void setFocus(Qt::FocusReason focusReason=Qt::OtherFocusReason)
Sets focus on the scene by sending a QFocusEvent to the scene, passing focusReason as the reason.
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene's current focus item, or \nullptr if no it...
bool event(QEvent *event) override
Processes the event event, and dispatches it to the respective event handlers.
void render(QPainter *painter, const QRectF &target=QRectF(), const QRectF &source=QRectF(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio)
Renders the source rect from scene into target, using painter.
QGraphicsSimpleTextItem * addSimpleText(const QString &text, const QFont &font=QFont())
Creates and adds a QGraphicsSimpleTextItem to the scene, and returns the item pointer.
QGraphicsItem * mouseGrabberItem() const
Returns the current mouse grabber item, or \nullptr if no item is currently grabbing the mouse.
virtual void drawForeground(QPainter *painter, const QRectF &rect)
Draws the foreground of the scene using painter, after the background and all items have been drawn.
QGraphicsItem * itemAt(const QPointF &pos, const QTransform &deviceTransform) const
The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsSce...
The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display form...
bool updateRect(const QRect &rect)
QGraphicsView::ViewportUpdateMode viewportUpdateMode
quint32 fullUpdatePending
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
bool isTransformed() const
QTransform viewportTransform() const
Returns a matrix that maps scene coordinates to viewport coordinates.
@ DontAdjustForAntialiasing
static QPalette palette()
Returns the current application palette.
static QInputMethod * inputMethod()
returns the input method.
bool remove(const Key &key)
Removes the item that has the key from the hash.
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
iterator erase(const_iterator it)
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
T value(const Key &key) const noexcept
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QKeyEvent class describes a key event.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
qreal length() const
Returns the length of the line.
qsizetype size() const noexcept
bool isEmpty() const noexcept
void removeAt(qsizetype i)
const T & constLast() const noexcept
bool removeOne(const AT &t)
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
const_reverse_iterator crbegin() const noexcept
const_iterator constBegin() const noexcept
void remove(qsizetype i, qsizetype n=1)
qsizetype removeAll(const AT &t)
void prepend(rvalue_ref t)
const T & constFirst() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
const_iterator constEnd() const noexcept
const_reverse_iterator crend() const noexcept
iterator insert(const Key &key, const T &value)
T value(const Key &key, const T &defaultValue=T()) const
iterator erase(const_iterator it)
bool contains(const Key &key) const
size_type remove(const Key &key)
const_iterator constBegin() const
const_iterator constEnd() const
iterator lowerBound(const Key &key)
bool contains(const Key &key) const
iterator insert(const Key &key, const T &value)
iterator erase(const_iterator it)
iterator upperBound(const Key &key)
bool isSignalConnected(uint signalIdx, bool checkDeclarative=true) const
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
QScopedPointer< QObjectData > d_ptr
qreal devicePixelRatio() const
virtual int devType() const
The QPainter class performs low-level painting on widgets and other paint devices.
const QPen & pen() const
Returns the painter's current pen.
Qt::LayoutDirection layoutDirection() const
Returns the layout direction used by the painter when drawing text.
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
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 setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false.
void setBrushOrigin(int x, int y)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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 setLayoutDirection(Qt::LayoutDirection direction)
Sets the layout direction used by the painter when drawing text, to the specified direction.
void restore()
Restores the current painter state (pops a saved state off the stack).
const QTransform & worldTransform() const
Returns the world transformation matrix.
const QBrush & brush() const
Returns the painter's current brush.
void setOpacity(qreal opacity)
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
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.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
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.
The QPalette class contains color groups for each widget state.
void setResolveMask(ResolveMask mask)
ResolveMask resolveMask() const
QPalette resolve(const QPalette &other) const
Returns a new QPalette that is a union of this instance and other.
const QBrush & window() const
Returns the window (general background) brush of the current color group.
static bool pathToRect(const QPainterPath &path, QRectF *rect=nullptr)
The QPixmapCache::Key class can be used for efficient access to the QPixmapCache.
static bool find(const QString &key, QPixmap *pixmap)
Looks for a cached pixmap associated with the given key in the cache.
static void remove(const QString &key)
Removes the pixmap associated with key from the cache.
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QSize size() const
Returns the size of the pixmap.
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
void setDevicePixelRatio(qreal scaleFactor)
Sets the device pixel ratio for the pixmap.
QRect rect() const
Returns the pixmap's enclosing rectangle.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
qreal devicePixelRatio() const
Returns the device pixel ratio for the pixmap.
\inmodule QtCore\reentrant
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 int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
const QPointingDevice * pointingDevice() const
Returns the source device from which this event originates.
const QList< QEventPoint > & points() const
Returns a list of points in this pointer event.
The QPolygonF class provides a list of points using floating point precision.
void update()
Schedules the window to render another frame.
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
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.
constexpr QRectF translated(qreal dx, qreal dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top 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
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
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.
QRect normalized() const noexcept
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
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.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr void translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
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
bool intersects(const QRegion &r) const
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
QList< T > values() const
bool remove(const T &value)
iterator erase(const_iterator i)
bool contains(const T &value) const
iterator insert(const T &value)
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
QEventPoint & point(int touchId)
QMap< int, QEventPoint > points
The QTouchEvent class contains parameters that describe a touch event.
QObject * target() const
Returns the target object within the window on which the event occurred.
QSize toSize() const
Returns the variant as a QSize if the variant has userType() \l QMetaType::QSize; otherwise returns a...
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ KeepAspectRatioByExpanding
@ IntersectsItemBoundingRect
@ IgnoredGesturesPropagateToParent
constexpr Initialization Uninitialized
@ ActiveWindowFocusReason
std::pair< T1, T2 > QPair
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const EGLAttrib EGLOutputLayerEXT * layers
bool qFuzzyIsNull(qfloat16 f) noexcept
bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item1 is on top of item2.
static void setClip(QPainter *painter, QGraphicsItem *item)
static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent)
static void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, const QTransform *effectTransform)
static bool transformIsSimple(const QTransform &transform)
QT_BEGIN_NAMESPACE bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
#define ENSURE_TRANSFORM_PTR
static void _q_paintItem(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, bool useWindowOpacity, bool painterStateProtection)
static bool updateHelper(QGraphicsViewPrivate *view, QGraphicsItemPrivate *item, const QRectF &rect, bool itemIsUntransformable)
static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &pixmapExposed, const QTransform &itemToPixmap, QPainter::RenderHints renderHints, const QStyleOptionGraphicsItem *option, bool painterStateProtection)
static QRectF adjustedItemBoundingRect(const QGraphicsItem *item)
static QRectF adjustedItemEffectiveBoundingRect(const QGraphicsItem *item)
static void _q_adjustRect(QRectF *rect)
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
static ControlElement< T > * ptr(QWidget *widget)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLint GLsizei GLsizei height
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei GLsizei GLfloat distance
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLsizei GLsizei GLchar * source
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLfixed GLfixed GLint GLint order
GLenum GLenum GLenum GLenum GLenum scale
static const QRectF boundingRect(const QPointF *points, int pointCount)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_ASSERT_X(cond, x, msg)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
QFileInfo info(fileName)
[8]
QFileInfo fi("c:/temp/foo")
[newstuff]
obj metaObject() -> className()
view viewport() -> scroll(dx, dy, deviceRect)
rect deviceTransform(view->viewportTransform()).map(QPointF(0
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
bool contains(const AT &t) const noexcept
qsizetype lastIndexOf(const AT &t, qsizetype from=-1) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent