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>
219#include <QtCore/qpointer.h>
223# define DEBUG if (0) qDebug
253 dirtyGrowingItemsBoundingRect(true),
255 calledEmitUpdated(
false),
256 processDirtyItemsEmitted(
false),
257 needSortTopLevelItems(true),
258 holesInTopLevelSiblingIndex(
false),
259 topLevelSequentialOrdering(true),
260 scenePosDescendantsUpdatePending(
false),
263 lastMouseGrabberItemHasImplicitMouseGrab(
false),
264 allItemsIgnoreHoverEvents(true),
265 allItemsUseDefaultCursor(true),
266 painterStateProtection(true),
267 sortCacheEnabled(
false),
268 allItemsIgnoreTouchEvents(true),
270 minimumRenderSize(0.0),
271 selectionChanging(0),
279 activationRefCount(0),
280 childExplicitActivation(0),
284 lastDropAction(
Qt::IgnoreAction),
303 qApp->d_func()->scene_list.append(
q);
336 if (!
view->d_func()->connectedToScene) {
337 view->d_func()->connectedToScene =
true;
339 view,
SLOT(updateScene(QList<QRectF>)));
348 view->d_func()->processPendingUpdates();
351 view->d_func()->dispatchPendingUpdateRequests();
356 QList<QRectF> oldUpdatedRects;
358 oldUpdatedRects <<
q->sceneRect();
363 std::back_inserter(oldUpdatedRects));
368 emit q->changed(oldUpdatedRects);
413 const QVariant booleanTrueVariant(
true);
418 for (
int i = 0;
i < oldUnpolishedCount; ++
i) {
424 if (!itemd->explicitlyHidden) {
428 if (itemd->isWidget) {
469 if (wasPendingSceneUpdate)
473 view->d_func()->processPendingUpdates();
484 view->d_func()->dispatchPendingUpdateRequests();
495 p =
p->d_ptr->parent;
530 p =
p->d_ptr->parent;
585 widget->d_func()->fixFocusChainBeforeReparenting(
nullptr, oldScene,
nullptr);
593 if (parentItem->scene()) {
594 Q_ASSERT_X(parentItem->scene() ==
q,
"QGraphicsScene::removeItem",
595 "Parent item's scene is different from this item's scene");
648 if (unpolishedIndex != -1)
657 if (iterator.value() ==
item || iterator.key() ==
item)
685 emit q->selectionChanged();
687#ifndef QT_NO_GESTURES
714 qWarning(
"QGraphicsScene::setActivePanel: item %p must be part of this scene",
734 if (fi ==
q->focusItem())
740 }
else if (
panel && !duringActivationEvent) {
742 const auto items =
q->items();
767 }
else if (
panel->isWidget()) {
774 fw = fw->d_func()->focusNext;
775 }
while (fw !=
panel);
777 }
else if (
q->isActive()) {
778 const auto items =
q->items();
802 bool emitFocusChanged)
819 if (emitFocusChanged)
859 if (emitFocusChanged)
908 widget->QGraphicsItem::d_ptr->setVisibleHelper(
false,
false);
923 qWarning(
"QGraphicsItem::grabMouse: already a mouse grabber");
929 qWarning(
"QGraphicsItem::grabMouse: already blocked by mouse grabber: %p",
963 qWarning(
"QGraphicsItem::ungrabMouse: not a mouse grabber");
1020 qWarning(
"QGraphicsItem::grabKeyboard: already a keyboard grabber");
1022 qWarning(
"QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p",
1048 qWarning(
"QGraphicsItem::ungrabKeyboard: not a keyboard grabber");
1086 view->viewport()->setMouseTracking(
true);
1102 if (!
view->isTransformed())
1119 for (
int i = 0x1;
i <= 0x10;
i <<= 1) {
1120 if (
event->buttons() &
i) {
1153 }
while (
it !=
end);
1186 if (
it.value()->sceneEventFilter(
it.key(),
event))
1204#if QT_CONFIG(gestures)
1207 if (gestureManager) {
1221 bool spont =
event->spontaneous();
1224 event->m_spont = spont;
1265 event.setWidget(hoverEvent->
widget());
1267 event.setPos(mapFromScene.
map(hoverEvent->
scenePos()));
1268 event.setScenePos(hoverEvent->
scenePos());
1269 event.setScreenPos(hoverEvent->
screenPos());
1273 event.setModifiers(hoverEvent->
modifiers());
1295 for (
int i = 0x1;
i <= 0x10;
i <<= 1) {
1301 mouseEvent->
setPos(itemPos);
1337 if (newActiveWindow && newActiveWindow->isBlockedByModalPanel(&topItem)) {
1339 newActiveWindow = topItem ? topItem->
window() :
nullptr;
1342 if (newActiveWindow !=
q->activeWindow())
1343 q->setActiveWindow(newActiveWindow);
1346 bool setFocus =
false;
1370 bool sceneModality =
false;
1371 for (
auto modalPanel : std::as_const(
modalPanels)) {
1373 sceneModality =
true;
1414 mousePress.accept();
1415 mousePress.setButton(mouseEvent->
button());
1416 mousePress.setButtons(mouseEvent->
buttons());
1417 mousePress.setScreenPos(mouseEvent->
screenPos());
1418 mousePress.setScenePos(mouseEvent->
scenePos());
1419 mousePress.setModifiers(mouseEvent->
modifiers());
1420 mousePress.setWidget(mouseEvent->
widget());
1421 mousePress.setButtonDownPos(mouseEvent->
button(),
1423 mousePress.setButtonDownScenePos(mouseEvent->
button(),
1425 mousePress.setButtonDownScreenPos(mouseEvent->
button(),
1461 dontClearSelection |= extendSelection;
1462 if (!dontClearSelection) {
1466 q->clearSelection();
1516 naturalFont.setResolveMask(0);
1536 const auto items =
q->items();
1573 naturalPalette.setResolveMask(0);
1593 const auto items =
q->items();
1659 qApp->d_func()->scene_list.removeAll(
this);
1665 const auto views =
d->views;
1667 view->setScene(
nullptr);
1688 if (
d->hasSceneRect)
1689 return d->sceneRect;
1691 if (
d->dirtyGrowingItemsBoundingRect) {
1694 QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect;
1696 thatd->dirtyGrowingItemsBoundingRect =
false;
1697 if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect)
1700 return d->growingItemsBoundingRect;
1705 if (
rect !=
d->sceneRect) {
1706 d->hasSceneRect = !
rect.isNull();
1707 d->sceneRect =
rect;
1758 if (targetRect.isNull()) {
1760 targetRect = sourceRect;
1766 qreal xratio = targetRect.width() / sourceRect.
width();
1767 qreal yratio = targetRect.height() / sourceRect.
height();
1770 switch (aspectRatioMode) {
1772 xratio = yratio =
qMin(xratio, yratio);
1775 xratio = yratio =
qMax(xratio, yratio);
1785 const qsizetype numItems = itemList.size();
1787 itemArray[numItems -
i - 1] = itemList.at(
i);
1796 .
translate(targetRect.left(), targetRect.top())
1797 .
scale(xratio, yratio)
1804 itemArray[
i]->
d_ptr->initStyleOption(&styleOptionArray[
i], painterTransform, targetRect.toRect());
1811 delete [] itemArray;
1812 delete [] styleOptionArray;
1836 return d->indexMethod;
1852 for (
int i = oldItems.size() - 1;
i >= 0; --
i)
1853 d->index->addItem(oldItems.at(
i));
1892 return bspTree ? bspTree->bspTreeDepth() : 0;
1898 qWarning(
"QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0",
depth);
1904 qWarning(
"QGraphicsScene::setBspTreeDepth: cannot apply if indexing method is not BSP");
1907 bspTree->setBspTreeDepth(
depth);
1921 const auto items_ =
items();
1936 return d->index->items(
order);
2073 qWarning(
"QGraphicsScene::collidingItems: cannot find collisions for null item");
2074 return QList<QGraphicsItem *>();
2078 QList<QGraphicsItem *> tmp;
2082 tmp << itemInVicinity;
2104 return itemsAtPoint.isEmpty() ?
nullptr : itemsAtPoint.first();
2136 QSet<QGraphicsItem *> actuallySelectedSet;
2139 actuallySelectedSet <<
item;
2142 that->d_func()->selectedItems = actuallySelectedSet;
2144 return d->selectedItems.values();
2157 return d->selectionArea;
2205 d->selectionArea =
path;
2207 QSet<QGraphicsItem *> unselectItems =
d->selectedItems;
2210 ++
d->selectionChanging;
2219 unselectItems.remove(
item);
2224 switch (selectionOperation) {
2237 --
d->selectionChanging;
2239 if (!
d->selectionChanging &&
changed)
2253 ++
d->selectionChanging;
2256 QSet<QGraphicsItem *> stillSelectedSet;
2262 stillSelectedSet <<
item;
2265 d->selectedItems = stillSelectedSet;
2268 --
d->selectionChanging;
2270 if (!
d->selectionChanging &&
changed)
2289 while (!
d->topLevelItems.isEmpty())
2290 delete d->topLevelItems.first();
2292 d->lastItemCount = 0;
2293 d->allItemsIgnoreHoverEvents =
true;
2294 d->allItemsUseDefaultCursor =
true;
2295 d->allItemsIgnoreTouchEvents =
true;
2296 d->focusOnTouch =
true;
2315 QList<QGraphicsItem *> ancestors;
2320 ancestors.append(
parent);
2325 if (!ancestors.isEmpty()) {
2327 int commonIndex = -1;
2332 commonIndex =
index;
2337 if (commonIndex == -1) {
2338 commonAncestor =
nullptr;
2342 commonAncestor = ancestors.at(commonIndex);
2348 if (!commonAncestor)
2400 qWarning(
"QGraphicsScene::addItem: cannot add null item");
2404 qWarning(
"QGraphicsScene::addItem: item has already been added to this scene");
2409 oldScene->removeItem(
item);
2414 QVariant::fromValue<QGraphicsScene *>(
this)));
2415 QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant);
2416 if (targetScene !=
this) {
2418 targetScene->addItem(
item);
2422 if (
d->unpolishedItems.isEmpty()) {
2426 d->unpolishedItems.append(
item);
2432 if (itemParent->d_ptr->scene !=
this)
2444 d->registerTopLevelItem(
item);
2450 d->dirtyGrowingItemsBoundingRect =
true;
2453 ++
d->selectionChanging;
2454 int oldSelectedItemSize =
d->selectedItems.size();
2461 return item->acceptsHover
2465 if (
d->allItemsIgnoreHoverEvents && needsMouseTracking(
item->
d_ptr.
data())) {
2466 d->allItemsIgnoreHoverEvents =
false;
2467 d->enableMouseTrackingOnViews();
2471 d->allItemsUseDefaultCursor =
false;
2472 if (
d->allItemsIgnoreHoverEvents)
2473 d->enableMouseTrackingOnViews();
2479 d->allItemsIgnoreTouchEvents =
false;
2480 d->enableTouchEventsOnViews();
2483#ifndef QT_NO_GESTURES
2486 d->grabGesture(
item,
it.key());
2491 d->selectedItems <<
item;
2495 d->enterModal(
item);
2501 if (!
d->tabFocusFirst) {
2508 myNewPrev->d_func()->focusNext =
widget;
2509 widget->d_func()->focusPrev->d_func()->focusNext =
d->tabFocusFirst;
2510 d->tabFocusFirst->d_func()->focusPrev =
widget->d_func()->focusPrev;
2511 widget->d_func()->focusPrev = myNewPrev;
2526 --
d->selectionChanging;
2527 if (!
d->selectionChanging &&
d->selectedItems.size() != oldSelectedItemSize)
2534 bool autoActivate =
true;
2538 if (
d->childExplicitActivation == 1)
2541 autoActivate =
false;
2542 d->childExplicitActivation = 0;
2544 d->childExplicitActivation = 0;
2549 if (!
d->lastActivePanel && !
d->activePanel &&
item->
isPanel()) {
2553 d->lastActivePanel =
item;
2558 d->registerScenePosItem(
item);
2565 d->updateInputMethodSensitivityInViews();
2817 qWarning(
"QGraphicsScene::removeItem: cannot remove 0-item");
2821 qWarning(
"QGraphicsScene::removeItem: item %p's scene (%p)"
2822 " is different from this scene (%p)",
2830 QVariant::fromValue<QGraphicsScene *>(0)));
2831 QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant);
2832 if (targetScene !=
nullptr && targetScene !=
this) {
2833 targetScene->addItem(
item);
2837 d->removeItemHelper(
item);
2842 d->updateInputMethodSensitivityInViews();
2859 return isActive() ?
d->focusItem :
d->passiveFocusItem;
2884 d->setFocusItemHelper(
item, focusReason);
2932 d->hasFocus =
false;
2933 d->passiveFocusItem =
d->focusItem;
2964 return d->stickyFocus;
2992 return !
d->mouseGrabberItems.isEmpty() ?
d->mouseGrabberItems.last() : 0;
3014 return d->backgroundBrush;
3019 d->backgroundBrush =
brush;
3021 view->resetCachedContent();
3050 return d->foregroundBrush;
3055 d->foregroundBrush =
brush;
3056 const auto views_ =
views();
3078 if (
value.userType() == QMetaType::QRectF)
3080 else if (
value.userType() == QMetaType::QPointF)
3082 else if (
value.userType() == QMetaType::QRect)
3084 else if (
value.userType() == QMetaType::QPoint)
3098 if (
d->updateAll || (
rect.isEmpty() && !
rect.isNull()))
3103 bool directUpdates = !(
d->isSignalConnected(
d->changedSignalIndex)) && !
d->views.isEmpty();
3104 if (
rect.isNull()) {
3105 d->updateAll =
true;
3106 d->updatedRects.clear();
3107 if (directUpdates) {
3109 for (
auto view : std::as_const(
d->views))
3110 view->d_func()->fullUpdatePending =
true;
3113 if (directUpdates) {
3115 for (
auto view : std::as_const(
d->views)) {
3116 if (
view->isTransformed())
3117 view->d_func()->updateRectF(
view->viewportTransform().mapRect(
rect));
3122 d->updatedRects.insert(
rect);
3126 if (!
d->calledEmitUpdated) {
3127 d->calledEmitUpdated =
true;
3164 const auto views_ =
views();
3205 for (
int i = 0;
i < 2; ++
i) {
3206 const auto items_ =
items();
3237 switch (
event->type()) {
3255 d->cachedItemsUnderMouse.clear();
3261 switch (
event->type()) {
3278 if (!
d->focusItem) {
3304 if (
event->isAccepted())
3313 d->lastSceneMousePos = mouseEvent->
scenePos();
3340 d->lastSceneMousePos = hoverEvent->
scenePos();
3341 d->dispatchHoverEvent(hoverEvent);
3346 "QGraphicsScene must not receive QEvent::Leave, use GraphicsSceneLeave");
3351 d->leaveScene(leaveEvent->widget());
3361 if (!
d->activationRefCount++) {
3362 if (
d->lastActivePanel) {
3364 d->setActivePanelHelper(
d->lastActivePanel,
true);
3365 }
else if (
d->tabFocusFirst &&
d->tabFocusFirst->isPanel()) {
3368 d->setActivePanelHelper(
d->tabFocusFirst,
true);
3372 const auto items_ =
items();
3381 if (!--
d->activationRefCount) {
3382 if (
d->activePanel) {
3386 d->setActivePanelHelper(
nullptr,
true);
3387 d->lastActivePanel = lastActivePanel;
3391 const auto items_ =
items();
3410 d->resolvePalette();
3432#ifndef QT_NO_GESTURES
3452 if (watched !=
qApp)
3455 switch (
event->type()) {
3515 d->dragDropItem =
nullptr;
3534 if (!
d->mouseGrabberItems.isEmpty()) {
3536 d->clearMouseGrabber();
3537 d->mouseGrabberButtonDownPos.clear();
3538 d->mouseGrabberButtonDownScenePos.clear();
3539 d->mouseGrabberButtonDownScreenPos.clear();
3542 bool eventDelivered =
false;
3546 const auto items =
d->itemsAtPosition(
event->screenPos(),
3553 if (
item !=
d->dragDropItem) {
3557 d->cloneDragDropEvent(&dragEnter,
event);
3558 dragEnter.setDropAction(
event->proposedAction());
3559 d->sendDragDropEvent(
item, &dragEnter);
3560 event->setAccepted(dragEnter.isAccepted());
3561 event->setDropAction(dragEnter.dropAction());
3562 if (!
event->isAccepted()) {
3567 d->lastDropAction =
event->dropAction();
3569 if (
d->dragDropItem) {
3575 d->cloneDragDropEvent(&dragLeave,
event);
3576 d->sendDragDropEvent(
d->dragDropItem, &dragLeave);
3580 d->dragDropItem =
item;
3584 event->setDropAction(
d->lastDropAction);
3587 if (
event->isAccepted())
3588 d->lastDropAction =
event->dropAction();
3589 eventDelivered =
true;
3593 if (!eventDelivered) {
3594 if (
d->dragDropItem) {
3597 d->cloneDragDropEvent(&dragLeave,
event);
3598 d->sendDragDropEvent(
d->dragDropItem, &dragLeave);
3599 d->dragDropItem =
nullptr;
3616 if (
d->dragDropItem) {
3618 d->sendDragDropEvent(
d->dragDropItem,
event);
3619 d->dragDropItem =
nullptr;
3634 if (
d->dragDropItem) {
3636 d->sendDragDropEvent(
d->dragDropItem,
event);
3637 d->dragDropItem =
nullptr;
3655 switch (focusEvent->
reason()) {
3665 if (
d->passiveFocusItem) {
3685 d->hasFocus =
false;
3686 d->passiveFocusItem =
d->focusItem;
3690 if (!
d->popupWidgets.isEmpty())
3691 d->removePopup(
d->popupWidgets.constFirst());
3711#if !QT_CONFIG(tooltip)
3716 const QList<QGraphicsItem *> itemsAtPos =
d->itemsAtPosition(
helpEvent->screenPos(),
3720 for (
auto item : itemsAtPos) {
3721 if (
item->d_func()->isProxyWidget()) {
3727 if (!
item->toolTip().isEmpty()) {
3736 if (toolTipItem && !toolTipItem->toolTip().isEmpty()) {
3737 text = toolTipItem->toolTip();
3788 commonAncestorItem = commonAncestorItem->
parentItem();
3789 if (commonAncestorItem && commonAncestorItem->
panel() !=
item->
panel()) {
3792 commonAncestorItem =
nullptr;
3807 QList<QGraphicsItem *> parents;
3817 for (
auto it = parents.crbegin(),
end = parents.crend();
it !=
end; ++
it) {
3842#if QT_CONFIG(tooltip)
3877 QGraphicsItem *
item = !
d->keyboardGrabberItems.isEmpty() ?
d->keyboardGrabberItems.constLast() : 0;
3887 if (
p->isBlockedByModalPanel())
3889 if (!
d->sendEvent(
p, keyEvent))
3891 }
while (!keyEvent->
isAccepted() && !
p->isPanel() && (
p =
p->parentItem()));
3909 QGraphicsItem *
item = !
d->keyboardGrabberItems.isEmpty() ?
d->keyboardGrabberItems.constLast() : 0;
3919 if (
p->isBlockedByModalPanel())
3921 if (!
d->sendEvent(
p, keyEvent))
3923 }
while (!keyEvent->
isAccepted() && !
p->isPanel() && (
p =
p->parentItem()));
3951 if (
d->mouseGrabberItems.isEmpty()) {
3955 d->dispatchHoverEvent(&hover);
3958 d->mousePressEventHandler(mouseEvent);
3976 if (
d->mouseGrabberItems.isEmpty()) {
3981 mouseEvent->
setAccepted(
d->dispatchHoverEvent(&hover));
3986 d->sendMouseEvent(mouseEvent);
4006 if (
d->mouseGrabberItems.isEmpty()) {
4012 d->sendMouseEvent(mouseEvent);
4017 if (!
d->mouseGrabberItems.isEmpty()) {
4018 d->lastMouseGrabberItem =
d->mouseGrabberItems.constLast();
4019 if (
d->lastMouseGrabberItemHasImplicitMouseGrab)
4020 d->mouseGrabberItems.constLast()->ungrabMouse();
4022 d->lastMouseGrabberItem =
nullptr;
4028 d->dispatchHoverEvent(&hoverEvent);
4054 d->mousePressEventHandler(mouseEvent);
4073 const QList<QGraphicsItem *> wheelCandidates =
d->itemsAtPosition(
wheelEvent->screenPos(),
4081 while (
iter >
d->popupWidgets.constBegin() && !wheelCandidates.isEmpty()) {
4083 if (wheelCandidates.first() == *
iter || (*iter)->isAncestorOf(wheelCandidates.first()))
4085 d->removePopup(*
iter);
4088 bool hasSetFocus =
false;
4124 d->sendEvent(
d->focusItem,
event);
4128 d->sendEvent(
d->lastFocusItem,
event);
4149 if (
d->painterStateProtection)
4153 if (
d->painterStateProtection)
4176 if (
d->painterStateProtection)
4180 if (
d->painterStateProtection)
4187 bool useWindowOpacity,
bool painterStateProtection)
4195 const qreal windowOpacity = (
proxy &&
proxy->widget() && useWindowOpacity)
4196 ?
proxy->widget()->windowOpacity() : 1.0;
4202 if (windowOpacity < 1.0)
4211 if (painterStateProtection)
4214 if (painterStateProtection)
4225 if (windowOpacity < 1.0)
4230 const QTransform &itemToPixmap, QPainter::RenderHints renderHints,
4235 QRect br = pixmapExposed.boundingRect();
4238 if (pixmapExposed.isEmpty() || (pixmapExposed.rectCount() == 1 && br.
contains(
pix->
rect()))) {
4240 pixmapPainter.begin(
pix);
4245 pixmapPainter.begin(&subPix);
4246 pixmapPainter.translate(-br.
topLeft());
4247 if (!pixmapExposed.isEmpty()) {
4250 pixmapPainter.setClipRegion(pixmapExposed);
4254 pixmapPainter.setRenderHints(pixmapPainter.renderHints(),
false);
4255 pixmapPainter.setRenderHints(renderHints,
true);
4256 pixmapPainter.setWorldTransform(itemToPixmap,
true);
4260 pixmapPainter.end();
4262 if (!subPix.isNull()) {
4264 pixmapPainter.begin(
pix);
4266 pixmapPainter.setClipRegion(pixmapExposed);
4267 pixmapPainter.drawPixmap(br.
topLeft(), subPix);
4268 pixmapPainter.end();
4285 if (m11 == 0.0f && m22 == 0.0f) {
4286 if (m12 == 1.0f && m21 == -1.0f)
4288 else if (m12 == -1.0f && m21 == 1.0f)
4290 else if (m12 == -1.0f && m21 == -1.0f)
4292 else if (m12 == 1.0f && m21 == 1.0f)
4306 bool painterStateProtection)
4319 qreal newPainterOpacity = oldPainterOpacity;
4322 const qreal windowOpacity =
proxy->widget()->windowOpacity();
4323 if (windowOpacity < 1.0)
4324 newPainterOpacity *= windowOpacity;
4329 QRectF adjustedBrect(brect);
4331 if (adjustedBrect.isEmpty())
4341 pixmapKey = itemCache->
key;
4354 if (fixedCacheSize) {
4357 pixmapSize = br.
size();
4360 pixmapSize *= devicePixelRatio;
4364 QSize adjustSize(adjust*2, adjust*2);
4365 br.
adjust(-adjust / devicePixelRatio, -adjust / devicePixelRatio, adjust / devicePixelRatio, adjust / devicePixelRatio);
4366 if (
pix.
isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) !=
pix.
size())) {
4387 if (fixedCacheSize) {
4389 (pixmapSize.height() / devicePixelRatio) / brect.
height());
4392 itemToPixmap.translate(-br.
x(), -br.
y());
4400 for (
const auto &
rect : std::as_const(itemCache->
exposed)) {
4401 exposedRect |=
rect;
4405 exposedRect = brect;
4425 if (newPainterOpacity != oldPainterOpacity) {
4448 QSize maximumCacheSize =
4450 if (!maximumCacheSize.
isEmpty()
4461 bool pixModified =
false;
4463 bool invertable =
true;
4468 bool allowPartialCacheExposure =
false;
4471 if (!simpleTransform) {
4477 }
else if (!viewRect.isNull()) {
4483 if (!allowPartialCacheExposure && !viewRect.isNull() && !viewRect.contains(
deviceRect)) {
4484 allowPartialCacheExposure = (viewRect.width() * 1.2 <
deviceRect.
width())
4489 if (allowPartialCacheExposure) {
4496 QPoint newCacheIndent(dx, dy);
4515 newPix.setDevicePixelRatio(devicePixelRatio);
4517 newPixPainter.drawPixmap(-diff,
pix);
4518 newPixPainter.end();
4521 exposed +=
QRect(
QPoint(0,0), newPix.size() / devicePixelRatio);
4523 exposed -=
QRect(-diff,
pix.
size() / devicePixelRatio);
4524 scrollExposure = exposed;
4558 QRegion pixmapExposed = scrollExposure;
4560 for (
const auto &
rect : std::as_const(itemCache->
exposed))
4561 pixmapExposed += itemToPixmap.mapRect(
rect).toRect().adjusted(-1, -1, 1, 1);
4569 for (
const auto &
rect : std::as_const(itemCache->
exposed))
4572 for (
const QRect &
r : std::as_const(scrollExposure))
4573 br |= pixmapToItem.mapRect(
r);
4598 if (newPainterOpacity != oldPainterOpacity) {
4622 exposedSceneRect = viewTransform->
inverted().
mapRect(exposedSceneRect);
4625 for (
const auto subTree : tli)
4641 if (!itemHasContents && !itemHasChildren)
4651 bool translateOnlyTransform =
false;
4652#define ENSURE_TRANSFORM_PTR \
4653 if (!transformPtr) { \
4654 Q_ASSERT(!itemIsUntransformable); \
4655 if (viewTransform) { \
4656 transform = item->d_ptr->sceneTransform; \
4657 transform *= *viewTransform; \
4658 transformPtr = &transform; \
4660 transformPtr = &item->d_ptr->sceneTransform; \
4661 translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; \
4667 bool wasDirtyParentSceneTransform =
false;
4669 if (itemIsUntransformable) {
4675 wasDirtyParentSceneTransform =
true;
4680 bool drawItem = itemHasContents && !itemIsFullyTransparent;
4684 QRectF preciseViewBoundingRect = translateOnlyTransform ? brect.
translated(transformPtr->
dx(), transformPtr->
dy())
4685 : transformPtr->
mapRect(brect);
4687 bool itemIsTooSmallToRender =
false;
4691 itemIsTooSmallToRender =
true;
4695 bool itemIsOutsideVisibleRect =
false;
4697 QRect viewBoundingRect = preciseViewBoundingRect.toAlignedRect();
4701 drawItem = exposedRegion ? exposedRegion->
intersects(viewBoundingRect)
4702 : !viewBoundingRect.normalized().isEmpty();
4703 itemIsOutsideVisibleRect = !drawItem;
4706 if (itemIsTooSmallToRender || itemIsOutsideVisibleRect) {
4712 if (!itemHasChildren)
4714 if (itemClipsChildrenToShape) {
4715 if (wasDirtyParentSceneTransform)
4722 if (itemHasChildren && itemClipsChildrenToShape)
4725#if QT_CONFIG(graphicseffect)
4729 painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent);
4731 QGraphicsItemEffectSourcePrivate *sourced =
static_cast<QGraphicsItemEffectSourcePrivate *
>
4733 sourced->info = &
info;
4735 if (effectTransform)
4748 QRect effectRect = sourced->paddedEffectRect(
Qt::DeviceCoordinates, sourced->currentCachedMode(), sourceRect).toAlignedRect();
4750 sourced->setCachedOffset(effectRect.topLeft());
4760 sourced->info =
nullptr;
4765 effectTransform, wasDirtyParentSceneTransform, drawItem);
4784 if (effectTransform)
4793 bool wasDirtyParentSceneTransform,
bool drawItem)
4800 bool setChildClip = itemClipsChildrenToShape;
4801 bool itemHasChildrenStackedBehind =
false;
4804 if (itemHasChildren) {
4805 if (itemClipsChildrenToShape)
4814 if (itemHasChildrenStackedBehind) {
4815 if (itemClipsChildrenToShape) {
4817 setChildClip =
false;
4823 if (wasDirtyParentSceneTransform)
4824 child->d_ptr->dirtySceneTransform = 1;
4840 ? *exposedRegion :
QRegion(), exposedRegion ==
nullptr);
4843 bool restorePainterClip =
false;
4845 if (!itemHasChildren || !itemClipsChildrenToShape) {
4848 if ((restorePainterClip = itemClipsToShape))
4850 }
else if (itemHasChildrenStackedBehind){
4853 if (itemClipsToShape) {
4859 setChildClip =
true;
4861 }
else if (itemClipsToShape) {
4866 setChildClip =
false;
4896 if (itemHasChildren) {
4902 if (wasDirtyParentSceneTransform)
4903 child->d_ptr->dirtySceneTransform = 1;
4910 if (itemClipsChildrenToShape)
4916 bool force,
bool ignoreOpacity,
bool removingItemFromScene,
4917 bool updateBoundingRect)
4933 if (
p->d_ptr->ignoreOpacity) {
4937 p =
p->d_ptr->parent;
4942 removingItemFromScene || invalidateChildren,
4957 const bool fullItemUpdate =
rect.isNull();
4958 if (!fullItemUpdate &&
rect.isEmpty())
4968 if (removingItemFromScene) {
4979 for (
auto view : std::as_const(
views)) {
4983 viewPrivate->updateRect(
rect);
4989 if (!hasNoContents) {
4996 invalidateChildren =
true;
4999 if (invalidateChildren) {
5009 if (!updateBoundingRect)
5014 const QRectF &
rect,
bool itemIsUntransformable)
5022 if (itemIsUntransformable) {
5023 const QTransform xform = itemq->deviceTransform(viewq->viewportTransform());
5024 if (!
item->hasBoundingRegionGranularity)
5029 if (
item->sceneTransformTranslateOnly &&
view->identityMatrix) {
5033 r.translate(dx -
view->horizontalScroll(), dy -
view->verticalScroll());
5034 return view->updateRectF(
r);
5037 if (!viewq->isTransformed()) {
5038 if (!
item->hasBoundingRegionGranularity)
5044 xform *= viewq->viewportTransform();
5045 if (!
item->hasBoundingRegionGranularity)
5051 qreal parentOpacity)
5070 if (!itemHasContents) {
5071 if (!itemHasChildren) {
5076 itemHasContents =
true;
5089 if (wasDirtyParentSceneTransform && !itemIsUntransformable) {
5095 if (itemIsFullyTransparent || !itemHasContents || dirtyAncestorContainsChildren) {
5100 if (itemIsFullyTransparent || !itemHasContents)
5128 if (!
rect.isEmpty())
5133 bool uninitializedDirtyRect =
true;
5135 for (
auto view : std::as_const(
views)) {
5138 if (viewPrivate->fullUpdatePending
5143 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5148 paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset);
5149 if (!viewPrivate->updateRect(paintedViewBoundingRect))
5150 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5157 && paintedViewBoundingRect.x() == -1 && paintedViewBoundingRect.y() == -1
5158 && paintedViewBoundingRect.width() == -1 && paintedViewBoundingRect.height() == -1) {
5162 if (uninitializedDirtyRect) {
5163 dirtyRect = itemBoundingRect;
5168 uninitializedDirtyRect =
false;
5176 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5190 const bool bypassUpdateClip = !itemHasContents && wasDirtyParentViewBoundingRects;
5191 if (itemClipsChildrenToShape && !bypassUpdateClip) {
5194 view->d_func()->setUpdateClip(
item);
5196 if (!dirtyAncestorContainsChildren) {
5198 && itemClipsChildrenToShape;
5204 if (wasDirtyParentSceneTransform)
5205 child->d_ptr->dirtySceneTransform = 1;
5206 if (wasDirtyParentViewBoundingRects)
5207 child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1;
5208 if (parentIgnoresVisible)
5209 child->d_ptr->ignoreVisible = 1;
5210 if (parentIgnoresOpacity)
5211 child->d_ptr->ignoreOpacity = 1;
5212 if (allChildrenDirty) {
5213 child->d_ptr->dirty = 1;
5214 child->d_ptr->fullUpdatePending = 1;
5215 child->d_ptr->dirtyChildren = 1;
5216 child->d_ptr->allChildrenDirty = 1;
5221 if (itemClipsChildrenToShape) {
5224 view->d_func()->setUpdateClip(
nullptr);
5226 }
else if (wasDirtyParentSceneTransform) {
5271 if (!
d->unpolishedItems.isEmpty())
5272 d->_q_polishItems();
5281 const quint32 oldRectAdjust =
d->rectAdjust;
5283 d->updateAll =
false;
5284 expose = &
view->d_func()->exposedRegion;
5292 QList<QGraphicsItem *> topLevelItems;
5293 for (
int i = 0;
i < numItems; ++
i) {
5296 topLevelItems <<
item;
5302 d->rectAdjust = oldRectAdjust;
5304 for (
auto topLevelItem : std::as_const(topLevelItems))
5305 topLevelItem->d_ptr->itemDiscovered = 0;
5334 if (
d->lastFocusItem && !
d->lastFocusItem->isWidget()) {
5340 if (
d->activePanel) {
5345 if (
d->activePanel->isWidget()) {
5353 fw =
next ? fw->d_func()->focusNext : fw->d_func()->focusPrev;
5354 }
while (fw !=
d->activePanel);
5358 if (!
item && !
d->tabFocusFirst) {
5366 widget =
next ?
d->tabFocusFirst :
d->tabFocusFirst->d_func()->focusPrev;
5369 widget =
next ? test->d_func()->focusNext : test->d_func()->focusPrev;
5390 }
while (
widget != widgetThatHadFocus);
5497 d->style->setParent(
this);
5504 const auto items_ =
items();
5546 naturalFont.setResolveMask(0);
5548 d->setFont_helper(resolvedFont);
5583 naturalPalette.setResolveMask(0);
5585 d->setPalette_helper(resolvedPalette);
5599 return d->activationRefCount > 0;
5612 return d->activePanel;
5629 d->setActivePanelHelper(
item,
false);
5643 if (
d->activePanel &&
d->activePanel->isWindow())
5659 qWarning(
"QGraphicsScene::setActiveWindow: widget %p must be part of this scene",
5678 z =
qMax(
z, sibling->zValue());
5683 panel->setZValue(
z + litt);
5703 qWarning(
"QGraphicsScene::sendEvent: cannot send event to a null item");
5707 qWarning(
"QGraphicsScene::sendEvent: item %p's scene (%p)"
5708 " is different from this scene (%p)",
5749 return d->minimumRenderSize;
5754 d->minimumRenderSize = minSize;
5784 return d->focusOnTouch;
5796#ifndef QT_NO_GESTURES
5799 view->viewport()->grabGesture(
it.key());
5813 for (
int i = 0;
i < touchEvent->pointCount(); ++
i) {
5814 auto &pt = touchEvent->
point(
i);
5815 QMutableEventPoint::setPosition(pt, mapFromScene.
map(pt.scenePosition()));
5821 int closestTouchPointId = -1;
5825 if (closestTouchPointId == -1||
distance < closestDistance) {
5826 closestTouchPointId = touchPoint.id();
5830 return closestTouchPointId;
5835 typedef QPair<QEventPoint::States, QList<QEventPoint> > StatesAndTouchPoints;
5836 QHash<QGraphicsItem *, StatesAndTouchPoints> itemsNeedingEvents;
5838 const auto &touchPoints = sceneTouchEvent->points();
5839 for (
const auto &touchPoint : touchPoints) {
5853 touchPoint.scenePosition(),
5854 static_cast<QWidget *
>(sceneTouchEvent->target()));
5884 StatesAndTouchPoints &statesAndTouchPoints = itemsNeedingEvents[
item];
5885 statesAndTouchPoints.
first = QEventPoint::States(statesAndTouchPoints.first | touchPoint.state());
5886 statesAndTouchPoints.second.append(touchPoint);
5889 if (itemsNeedingEvents.isEmpty()) {
5890 sceneTouchEvent->ignore();
5894 bool ignoreSceneTouchEvent =
true;
5904 switch (
it.value().first) {
5922 QMutableTouchEvent touchEvent(eventType, sceneTouchEvent->pointingDevice(), sceneTouchEvent->modifiers(),
it.value().second);
5923 touchEvent.setTarget(sceneTouchEvent->target());
5924 touchEvent.setModifiers(sceneTouchEvent->modifiers());
5925 touchEvent.setTimestamp(sceneTouchEvent->timestamp());
5927 switch (touchEvent.type()) {
5936 const auto &unhandledTouchPoints = touchEvent.
points();
5937 for (
const auto &touchPoint : unhandledTouchPoints) {
5941 ignoreSceneTouchEvent =
false;
5949 ignoreSceneTouchEvent =
false;
5955 sceneTouchEvent->QInputEvent::setAccepted(ignoreSceneTouchEvent);
5966 firstTouchPoint.scenePosition(),
5967 static_cast<QWidget *
>(touchEvent->target()));
5971 bool setFocus =
false;
5999 bool eventAccepted = touchEvent->isAccepted();
6004 touchEvent->setAccepted(acceptTouchEvents);
6006 eventAccepted = touchEvent->isAccepted();
6013 touchEvent->m_spont =
false;
6014 if (
res && eventAccepted) {
6016 const auto &touchPoints = touchEvent->
points();
6017 for (
const auto &touchPoint : touchPoints)
6026 touchEvent->QInputEvent::setAccepted(eventAccepted);
6039 view->d_func()->updateInputMethodSensitivity();
6051 panel->
d_ptr->panelModality = previousModality;
6054 QSet<QGraphicsItem *> blockedPanels;
6056 const auto items_ =
q->items();
6057 for (
const auto &
item : items_) {
6059 blockedPanels.insert(
item);
6088 const auto items_ =
q->items();
6089 for (
const auto &
item : items_) {
6108 QSet<QGraphicsItem *> blockedPanels;
6110 const auto items_ =
q->items();
6111 for (
const auto &
item : items_) {
6113 blockedPanels.insert(
item);
6121 const auto items_ =
q->items();
6122 for (
const auto &
item : items_) {
6134#ifndef QT_NO_GESTURES
6138 QSet<QGraphicsObject *> *itemsSet,
6139 QSet<QGesture *> *normal,
6140 QSet<QGesture *> *conflicts)
6142 QSet<QGesture *> normalGestures;
6143 for (
QGesture *gesture : gestures) {
6144 if (!gesture->hasHotSpot())
6159 if (
it !=
d->gestureContext.
constEnd() && (!flag || (
it.value() & flag))) {
6160 if (normalGestures.contains(gesture)) {
6161 normalGestures.remove(gesture);
6163 conflicts->insert(gesture);
6165 normalGestures.insert(gesture);
6168 (*targets)[itemobj].insert(gesture);
6170 (*itemsSet).insert(itemobj);
6179 *normal = normalGestures;
6191 const QList<QGesture *> allGestures =
event->gestures();
6192 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6193 <<
"Gestures:" << allGestures;
6195 QSet<QGesture *> startedGestures;
6199 for (
QGesture *gesture : allGestures) {
6201 if (gesture->hasHotSpot()) {
6202 gesture->d_func()->sceneHotSpot = toScene.
map(gesture->hotSpot());
6204 gesture->d_func()->sceneHotSpot =
QPointF();
6212 startedGestures.insert(gesture);
6216 if (!startedGestures.isEmpty()) {
6217 QSet<QGesture *> normalGestures;
6218 QSet<QGesture *> conflictedGestures;
6220 &normalGestures, &conflictedGestures);
6223 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6224 <<
"Normal gestures:" << normalGestures
6225 <<
"Conflicting gestures:" << conflictedGestures;
6229 if (!conflictedGestures.isEmpty()) {
6235 if (gestures.isEmpty())
6238 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6239 <<
"delivering override to"
6244 ev.setWidget(
event->widget());
6248 ev.setAccepted(
g,
false);
6252 if (ev.isAccepted() || ev.isAccepted(
g)) {
6253 conflictedGestures.remove(
g);
6257 QHash<QGraphicsObject *, QSet<QGesture *> >::iterator
it, e;
6260 for(;
it != e; ++
it)
6264 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6265 <<
"override was accepted:"
6275 if (conflictedGestures.isEmpty())
6281 if (!normalGestures.isEmpty()) {
6290 normalGestures.remove(
g);
6299 QSet<QGesture *> undeliveredGestures;
6300 QSet<QGesture *> parentPropagatedGestures;
6301 for (
QGesture *gesture : allGestures) {
6305 undeliveredGestures.insert(gesture);
6309 parentPropagatedGestures.insert(gesture);
6311 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6312 <<
"no target for" << gesture <<
"at"
6313 << gesture->hotSpot() << gesture->d_func()->sceneHotSpot;
6319 const QSet<QGesture *> gestures = (undeliveredGestures
6323 if (gestures.isEmpty())
6327 const bool isPanel = receiver.data()->isPanel();
6329 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6331 << receiver.data() << gestures;
6333 ev.setWidget(
event->widget());
6335 QSet<QGesture *> ignoredGestures;
6337 if (!ev.isAccepted() && !ev.isAccepted(
g)) {
6344 ignoredGestures.insert(
g);
6351 undeliveredGestures.remove(
g);
6354 if (undeliveredGestures.isEmpty())
6359 if (!ignoredGestures.isEmpty() && !isPanel) {
6368 it != ignoredGestures.
end();) {
6369 if (parentPropagatedGestures.contains(*
it)) {
6375 if (
item->d_func()->gestureContext.
contains(gestureType)) {
6376 targetsSet.insert(
obj);
6397 DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:"
6404 for (
QGesture *
g : std::as_const(startedGestures)) {
6406 DEBUG() <<
"lets try to cancel some";
6414 switch (
g->state()) {
6433 if (originalItem ==
nullptr)
6439 QSet<QGesture *> canceledGestures;
6445 DEBUG() <<
" found a gesture to cancel" <<
iter.key();
6447 canceledGestures <<
iter.key();
6453 QSet<QGesture *> almostCanceledGestures = canceledGestures;
6455 while (!almostCanceledGestures.isEmpty()) {
6457 QSet<QGesture*> gestures;
6458 setIter = almostCanceledGestures.begin();
6460 while (setIter != almostCanceledGestures.end()) {
6465 gestures << *setIter;
6466 setIter = almostCanceledGestures.erase(setIter);
6473 const QList<QGesture *>
list = gestures.values();
6477 if (!ev.isAccepted()) {
6480 if (ev.isAccepted(
g))
6483 if (!
g->hasHotSpot())
6492 if (
d->gestureContext.contains(
g->gestureType())) {
6493 QList<QGesture *>
list;
6497 if (ev.isAccepted() || ev.isAccepted(
g))
6507 for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) {
6508 gestureManager->
recycle(*setIter);
6518 view->viewport()->grabGesture(gesture);
6530 view->viewport()->ungrabGesture(gesture);
6537#include "moc_qgraphicsscene.cpp"
static QApplicationPrivate * instance()
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.
int id
the ID number of this event 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...
The QGestureEvent class provides the description of triggered gestures.
void recycle(QGesture *gesture)
bool filterEvent(QWidget *receiver, QEvent *event)
static QGestureManager * instance(InstanceCreation ic=ForceCreation)
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()
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
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...
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
void setButtons(Qt::MouseButtons buttons)
void setMimeData(const QMimeData *data)
void setPossibleActions(Qt::DropActions actions)
void setProposedAction(Qt::DropAction action)
void setModifiers(Qt::KeyboardModifiers modifiers)
void setDropAction(Qt::DropAction action)
This function lets the receiver of the drop set the drop action that was performed to action,...
void setSource(QWidget *source)
void setScreenPos(const QPoint &pos)
void setPos(const QPointF &pos)
void setScenePos(const QPointF &pos)
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...
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 invalidate(qreal x, qreal y, qreal w, qreal h, SceneLayers layers=AllLayers)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
void update(qreal x, qreal y, qreal w, qreal h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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...
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...
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
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.
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.
\inmodule QtCore\compares equality \compareswith equality QLine \endcompareswith
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_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 append(parameter_type t)
const_iterator constEnd() 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...
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 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 fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
The QPalette class contains color groups for each widget state.
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
\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.
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 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.
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr 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.
bool intersects(const QRegion &r) const
T * data() const noexcept
Returns the value of the pointer referenced by this object.
bool remove(const T &value)
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
iterator erase(const_iterator i)
const_iterator constFind(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 noexcept
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.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ KeepAspectRatioByExpanding
@ IntersectsItemBoundingRect
@ IgnoredGesturesPropagateToParent
constexpr Initialization Uninitialized
@ ActiveWindowFocusReason
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)
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
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