216 #ifndef QT_NO_GRAPHICSVIEW 231 #include <QtCore/qdebug.h> 232 #include <QtCore/qlist.h> 233 #include <QtCore/qmath.h> 234 #include <QtCore/qrect.h> 235 #include <QtCore/qset.h> 236 #include <QtCore/qstack.h> 237 #include <QtCore/qtimer.h> 238 #include <QtCore/qvarlengtharray.h> 239 #include <QtCore/QMetaMethod> 240 #include <QtGui/qapplication.h> 241 #include <QtGui/qdesktopwidget.h> 242 #include <QtGui/qevent.h> 243 #include <QtGui/qgraphicslayout.h> 244 #include <QtGui/qgraphicsproxywidget.h> 245 #include <QtGui/qgraphicswidget.h> 246 #include <QtGui/qmatrix.h> 247 #include <QtGui/qpaintengine.h> 248 #include <QtGui/qpainter.h> 249 #include <QtGui/qpixmapcache.h> 250 #include <QtGui/qpolygon.h> 251 #include <QtGui/qstyleoption.h> 252 #include <QtGui/qtooltip.h> 253 #include <QtGui/qtransform.h> 254 #include <QtGui/qinputcontext.h> 255 #include <QtGui/qgraphicseffect.h> 256 #ifndef QT_NO_ACCESSIBILITY 257 # include <QtGui/qaccessible.h> 260 #include <private/qapplication_p.h> 261 #include <private/qobject_p.h> 263 #include <private/qt_x11_p.h> 265 #include <private/qgraphicseffect_p.h> 266 #include <private/qgesturemanager_p.h> 267 #include <private/qpathclipper_p.h> 270 #ifndef GESTURE_DEBUG 271 # define G_DEBUG if (0) qDebug 273 # define G_DEBUG qDebug 301 dirtyGrowingItemsBoundingRect(true),
303 calledEmitUpdated(false),
304 processDirtyItemsEmitted(false),
305 needSortTopLevelItems(true),
306 holesInTopLevelSiblingIndex(false),
307 topLevelSequentialOrdering(true),
308 scenePosDescendantsUpdatePending(false),
311 lastMouseGrabberItemHasImplicitMouseGrab(false),
312 allItemsIgnoreHoverEvents(true),
313 allItemsUseDefaultCursor(true),
314 painterStateProtection(true),
315 sortCacheEnabled(false),
316 allItemsIgnoreTouchEvents(true),
317 selectionChanging(0),
325 activationRefCount(0),
326 childExplicitActivation(0),
327 lastMouseGrabberItem(0),
349 qApp->d_func()->scene_list.append(q);
383 if (!view->d_func()->connectedToScene) {
384 view->d_func()->connectedToScene =
true;
395 views.
at(i)->d_func()->processPendingUpdates();
398 views.
at(i)->d_func()->dispatchPendingUpdateRequests();
407 emit q->changed(oldUpdatedRects);
452 const QVariant booleanTrueVariant(
true);
457 for (
int i = 0; i < oldUnpolishedCount; ++i) {
508 if (wasPendingSceneUpdate)
512 views.
at(i)->d_func()->processPendingUpdates();
523 views.
at(i)->d_func()->dispatchPendingUpdateRequests();
615 item->d_func()->
scene = 0;
627 widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0);
635 if (parentItem->scene()) {
636 Q_ASSERT_X(parentItem->scene() == q,
"QGraphicsScene::removeItem",
637 "Parent item's scene is different from this item's scene");
662 if (it.
value() == item) {
681 if (unpolishedIndex != -1)
690 if (iterator.
value() == item || iterator.
key() == item)
718 emit q->selectionChanged();
720 #ifndef QT_NO_GESTURES 723 if (it.
value() == item)
736 #endif // QT_NO_GESTURES 745 if (item && item->
scene() != q) {
746 qWarning(
"QGraphicsScene::setActivePanel: item %p must be part of this scene",
757 if (panel ==
activePanel || (!q->isActive() && !duringActivationEvent))
764 if (fi == q->focusItem())
770 }
else if (panel && !duringActivationEvent) {
775 q->sendEvent(item, &event);
787 q->sendEvent(panel, &event);
792 }
else if (q->isActive()) {
797 q->sendEvent(item, &event);
849 if (item && item->
scene() != q)
856 #ifndef QT_NO_ACCESSIBILITY 914 ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying);
916 if (!itemIsDying && widget->
isVisible()) {
917 widget->QGraphicsItem::d_ptr->setVisibleHelper(
false,
false);
932 qWarning(
"QGraphicsItem::grabMouse: already a mouse grabber");
938 qWarning(
"QGraphicsItem::grabMouse: already blocked by mouse grabber: %p",
972 qWarning(
"QGraphicsItem::ungrabMouse: not a mouse grabber");
1029 qWarning(
"QGraphicsItem::grabKeyboard: already a keyboard grabber");
1031 qWarning(
"QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p",
1057 qWarning(
"QGraphicsItem::ungrabKeyboard: not a keyboard grabber");
1128 for (
int i = 0x1; i <= 0x10; i <<= 1) {
1162 }
while (it != end);
1217 #ifndef QT_NO_GESTURES 1219 if (gestureManager) {
1223 #endif // QT_NO_GESTURES 1233 bool spont =
event->spontaneous();
1236 event->spont = spont;
1277 event.setWidget(hoverEvent->
widget());
1279 event.setScenePos(hoverEvent->
scenePos());
1280 event.setScreenPos(hoverEvent->
screenPos());
1284 event.setModifiers(hoverEvent->
modifiers());
1304 for (
int i = 0x1; i <= 0x10; i <<= 1) {
1348 newActiveWindow = topItem ? topItem->
window() : 0;
1351 if (newActiveWindow != q->activeWindow())
1352 q->setActiveWindow(newActiveWindow);
1355 bool setFocus =
false;
1379 bool sceneModality =
false;
1382 sceneModality =
true;
1414 bool isPanel = item->
isPanel();
1422 mousePress.spont = mouseEvent->spont;
1469 if (!dontClearSelection) {
1473 q->clearSelection();
1515 if (this->font == font && this->font.
resolve() == font.
resolve())
1580 if (this->palette == palette && this->palette.
resolve() == palette.
resolve())
1685 qApp->d_func()->scene_list.removeAll(
this);
1690 for (
int j = 0; j <
d->views.size(); ++j)
1691 d->views.at(j)->setScene(0);
1715 if (
d->hasSceneRect)
1716 return d->sceneRect;
1718 if (
d->dirtyGrowingItemsBoundingRect) {
1727 return d->growingItemsBoundingRect;
1732 if (rect !=
d->sceneRect) {
1733 d->hasSceneRect = !rect.
isNull();
1734 d->sceneRect = rect;
1785 QRectF sourceRect = source;
1790 QRectF targetRect = target;
1791 if (targetRect.
isNull()) {
1793 targetRect = sourceRect;
1803 switch (aspectRatioMode) {
1805 xratio = yratio =
qMin(xratio, yratio);
1808 xratio = yratio =
qMax(xratio, yratio);
1818 int numItems = itemList.
size();
1819 for (
int i = 0; i < numItems; ++i)
1820 itemArray[numItems - i - 1] = itemList.
at(i);
1830 .scale(xratio, yratio)
1840 for (
int i = 0; i < numItems; ++i)
1841 itemArray[i]->
d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.
toRect());
1845 drawItems(painter, numItems, itemArray, styleOptionArray);
1848 delete [] itemArray;
1849 delete [] styleOptionArray;
1876 return d->indexMethod;
1881 if (
d->indexMethod == method)
1884 d->indexMethod = method;
1892 for (
int i = oldItems.
size() - 1; i >= 0; --i)
1893 d->index->addItem(oldItems.
at(i));
1941 qWarning(
"QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0", depth);
1947 qWarning(
"QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP");
1967 return d->sortCacheEnabled;
1972 if (
d->sortCacheEnabled == enabled)
2013 return d->index->items(order);
2159 return d->index->items(pos, mode, order, deviceTransform);
2186 return d->index->items(rect, mode, order, deviceTransform);
2213 return d->index->items(polygon, mode, order, deviceTransform);
2240 return d->index->items(path, mode, order, deviceTransform);
2260 qWarning(
"QGraphicsScene::collidingItems: cannot find collisions for null item");
2267 if (item != itemInVicinity && item->
collidesWithItem(itemInVicinity, mode))
2268 tmp << itemInVicinity;
2292 return itemsAtPoint.
isEmpty() ? 0 : itemsAtPoint.
first();
2313 return itemsAtPoint.
isEmpty() ? 0 : itemsAtPoint.
first();
2368 actuallySelectedSet << item;
2373 return d->selectedItems.values();
2386 return d->selectionArea;
2472 d->selectionArea = path;
2477 ++
d->selectionChanging;
2485 unselectItems.
remove(item);
2497 --
d->selectionChanging;
2499 if (!
d->selectionChanging && changed)
2513 ++
d->selectionChanging;
2514 bool changed = !
d->selectedItems.isEmpty();
2518 d->selectedItems.clear();
2521 --
d->selectionChanging;
2523 if (!
d->selectionChanging && changed)
2545 while (!
d->topLevelItems.isEmpty())
2546 delete d->topLevelItems.first();
2548 d->lastItemCount = 0;
2549 d->allItemsIgnoreHoverEvents =
true;
2550 d->allItemsUseDefaultCursor =
true;
2551 d->allItemsIgnoreTouchEvents =
true;
2575 ancestors.
append(parent);
2581 while (n < items.
size()) {
2582 int commonIndex = -1;
2587 commonIndex =
index;
2592 if (commonIndex == -1) {
2597 commonAncestor = ancestors.
at(commonIndex);
2603 if (!commonAncestor)
2654 qWarning(
"QGraphicsScene::addItem: cannot add null item");
2658 qWarning(
"QGraphicsScene::addItem: item has already been added to this scene");
2663 oldScene->removeItem(item);
2668 QVariant::fromValue<QGraphicsScene *>(
this)));
2670 if (targetScene !=
this) {
2671 if (targetScene && item->
d_ptr->
scene != targetScene)
2679 if (
d->unpolishedItems.isEmpty()) {
2683 d->unpolishedItems.append(item);
2690 if (itemParent->d_ptr->scene !=
this)
2695 item->d_func()->
scene = targetScene;
2698 d->index->addItem(item);
2702 d->registerTopLevelItem(item);
2708 d->dirtyGrowingItemsBoundingRect =
true;
2711 ++
d->selectionChanging;
2712 int oldSelectedItemSize =
d->selectedItems.size();
2715 if (
d->allItemsIgnoreHoverEvents &&
d->itemAcceptsHoverEvents_helper(item)) {
2716 d->allItemsIgnoreHoverEvents =
false;
2717 d->enableMouseTrackingOnViews();
2719 #ifndef QT_NO_CURSOR 2721 d->allItemsUseDefaultCursor =
false;
2722 if (
d->allItemsIgnoreHoverEvents)
2723 d->enableMouseTrackingOnViews();
2725 #endif //QT_NO_CURSOR 2729 d->allItemsIgnoreTouchEvents =
false;
2730 d->enableTouchEventsOnViews();
2733 #ifndef QT_NO_GESTURES 2735 d->grabGesture(item, gesture);
2740 d->selectedItems << item;
2742 d->addPopup(static_cast<QGraphicsWidget *>(item));
2744 d->enterModal(item);
2750 if (!
d->tabFocusFirst) {
2758 last->d_func()->focusNext =
widget;
2759 widget->d_func()->focusPrev = last;
2760 d->tabFocusFirst->d_func()->focusPrev = lastNew;
2761 lastNew->d_func()->focusNext =
d->tabFocusFirst;
2776 --
d->selectionChanging;
2777 if (!
d->selectionChanging &&
d->selectedItems.size() != oldSelectedItemSize)
2784 bool autoActivate =
true;
2787 if (
d->childExplicitActivation && item->
isPanel()) {
2788 if (
d->childExplicitActivation == 1)
2791 autoActivate =
false;
2792 d->childExplicitActivation = 0;
2794 d->childExplicitActivation = 0;
2799 if (!
d->lastActivePanel && !
d->activePanel && item->
isPanel()) {
2803 d->lastActivePanel = item;
2808 d->registerScenePosItem(item);
2812 if (!
d->focusItem && item !=
d->lastFocusItem && item->
focusItem() == item)
2815 d->updateInputMethodSensitivityInViews();
3067 qWarning(
"QGraphicsScene::removeItem: cannot remove 0-item");
3070 if (item->
scene() !=
this) {
3071 qWarning(
"QGraphicsScene::removeItem: item %p's scene (%p)" 3072 " is different from this scene (%p)",
3073 item, item->
scene(),
this);
3080 QVariant::fromValue<QGraphicsScene *>(0)));
3082 if (targetScene != 0 && targetScene !=
this) {
3087 d->removeItemHelper(item);
3092 d->updateInputMethodSensitivityInViews();
3109 return isActive() ?
d->focusItem :
d->passiveFocusItem;
3134 d->setFocusItemHelper(item, focusReason);
3182 d->hasFocus =
false;
3183 d->passiveFocusItem =
d->focusItem;
3217 return d->stickyFocus;
3245 return !
d->mouseGrabberItems.isEmpty() ?
d->mouseGrabberItems.last() : 0;
3270 return d->backgroundBrush;
3275 d->backgroundBrush = brush;
3309 return d->foregroundBrush;
3314 d->foregroundBrush = brush;
3334 const QTransform matrix =
d->focusItem->sceneTransform();
3335 QVariant value =
d->focusItem->inputMethodQuery(query);
3364 bool directUpdates = !(
d->isSignalConnected(
d->changedSignalIndex)) && !
d->views.isEmpty();
3366 d->updateAll =
true;
3367 d->updatedRects.clear();
3368 if (directUpdates) {
3370 for (
int i = 0; i <
d->views.size(); ++i)
3371 d->views.at(i)->d_func()->fullUpdatePending =
true;
3374 if (directUpdates) {
3376 for (
int i = 0; i <
d->views.size(); ++i) {
3381 view->d_func()->updateRectF(rect);
3384 d->updatedRects << rect;
3388 if (!
d->calledEmitUpdated) {
3389 d->calledEmitUpdated =
true;
3463 for (
int i = 0; i < 2; ++i) {
3491 switch (event->
type()) {
3509 d->cachedItemsUnderMouse.clear();
3514 switch (event->
type()) {
3516 dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent *>(event));
3519 dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event));
3522 dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event));
3525 dropEvent(static_cast<QGraphicsSceneDragDropEvent *>(event));
3531 if (!
d->focusItem) {
3556 d->sendEvent(parent, event);
3566 d->lastSceneMousePos = mouseEvent->
scenePos();
3580 wheelEvent(static_cast<QGraphicsSceneWheelEvent *>(event));
3593 d->lastSceneMousePos = hoverEvent->
scenePos();
3594 d->dispatchHoverEvent(hoverEvent);
3599 d->leaveScene(reinterpret_cast<QWidget *>(event->
d));
3602 helpEvent(static_cast<QGraphicsSceneHelpEvent *>(event));
3608 if (!
d->activationRefCount++) {
3609 if (
d->lastActivePanel) {
3611 d->setActivePanelHelper(
d->lastActivePanel,
true);
3612 }
else if (
d->tabFocusFirst &&
d->tabFocusFirst->isPanel()) {
3615 d->setActivePanelHelper(
d->tabFocusFirst,
true);
3627 if (
d->activationRefCount > 0)
3628 --
d->activationRefCount;
3629 if (!
d->activationRefCount) {
3630 if (
d->activePanel) {
3634 d->setActivePanelHelper(0,
true);
3635 d->lastActivePanel = lastActivePanel;
3657 d->resolvePalette();
3672 d->touchEventHandler(static_cast<QTouchEvent *>(event));
3674 #ifndef QT_NO_GESTURES 3677 d->gestureEventHandler(static_cast<QGestureEvent *>(event));
3679 #endif // QT_NO_GESTURES 3697 if (watched !=
qApp)
3700 switch (event->
type()) {
3726 contextMenuEvent->
ignore();
3732 contextMenuEvent->
widget())) {
3734 contextMenuEvent->
widget()));
3735 contextMenuEvent->
accept();
3736 if (!
d->sendEvent(item, contextMenuEvent))
3757 d->dragDropItem = 0;
3774 if (!
d->mouseGrabberItems.isEmpty()) {
3776 d->clearMouseGrabber();
3777 d->mouseGrabberButtonDownPos.clear();
3778 d->mouseGrabberButtonDownScenePos.clear();
3779 d->mouseGrabberButtonDownScreenPos.clear();
3782 bool eventDelivered =
false;
3792 if (item !=
d->dragDropItem) {
3796 d->cloneDragDropEvent(&dragEnter, event);
3798 d->sendDragDropEvent(item, &dragEnter);
3800 event->setDropAction(dragEnter.
dropAction());
3806 d->lastDropAction =
event->dropAction();
3808 if (
d->dragDropItem) {
3814 d->cloneDragDropEvent(&dragLeave, event);
3815 d->sendDragDropEvent(
d->dragDropItem, &dragLeave);
3819 d->dragDropItem = item;
3823 event->setDropAction(
d->lastDropAction);
3825 d->sendDragDropEvent(item, event);
3828 eventDelivered =
true;
3832 if (!eventDelivered) {
3833 if (
d->dragDropItem) {
3836 d->cloneDragDropEvent(&dragLeave, event);
3837 d->sendDragDropEvent(
d->dragDropItem, &dragLeave);
3838 d->dragDropItem = 0;
3855 if (
d->dragDropItem) {
3857 d->sendDragDropEvent(
d->dragDropItem, event);
3858 d->dragDropItem = 0;
3873 if (
d->dragDropItem) {
3875 d->sendDragDropEvent(
d->dragDropItem, event);
3876 d->dragDropItem = 0;
3894 switch (focusEvent->
reason()) {
3904 if (
d->passiveFocusItem) {
3924 d->hasFocus =
false;
3925 d->passiveFocusItem =
d->focusItem;
3929 if (!
d->popupWidgets.isEmpty())
3930 d->removePopup(
d->popupWidgets.first());
3948 #ifdef QT_NO_TOOLTIP 3957 for (
int i = 0; i < itemsAtPos.
size(); ++i) {
3959 if (tmp->d_func()->isProxyWidget()) {
3975 text = toolTipItem->
toolTip();
3987 && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration()))
4001 if (allItemsIgnoreHoverEvents)
4006 if (cachedItemsUnderMouse.isEmpty()) {
4007 cachedItemsUnderMouse = itemsAtPosition(hoverEvent->
screenPos(),
4013 for (
int i = 0; i < cachedItemsUnderMouse.size(); ++i) {
4015 if (itemAcceptsHoverEvents_helper(tmp)) {
4024 while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem))
4025 commonAncestorItem = commonAncestorItem->
parentItem();
4026 if (commonAncestorItem && commonAncestorItem->
panel() != item->
panel()) {
4029 commonAncestorItem = 0;
4033 int index = commonAncestorItem ? hoverItems.indexOf(commonAncestorItem) : -1;
4036 for (
int i = hoverItems.size() - 1; i >
index; --i) {
4038 if (itemAcceptsHoverEvents_helper(lastItem))
4046 while (parent && parent != commonAncestorItem) {
4054 for (
int i = 0; i < parents.
size(); ++i) {
4055 parent = parents.
at(i);
4057 if (itemAcceptsHoverEvents_helper(parent))
4063 && !hoverItems.isEmpty()
4064 && item == hoverItems.last()) {
4082 #ifndef QT_NO_TOOLTIP 4093 hoverEvent.setLastScenePos(hoverEvent.scenePos());
4094 hoverEvent.setScreenPos(cursorPos);
4095 hoverEvent.setLastScreenPos(hoverEvent.screenPos());
4098 while (!hoverItems.isEmpty()) {
4100 if (itemAcceptsHoverEvents_helper(lastItem))
4117 QGraphicsItem *item = !
d->keyboardGrabberItems.isEmpty() ?
d->keyboardGrabberItems.last() : 0;
4129 if (!
d->sendEvent(p, keyEvent))
4149 QGraphicsItem *item = !
d->keyboardGrabberItems.isEmpty() ?
d->keyboardGrabberItems.last() : 0;
4161 if (!
d->sendEvent(p, keyEvent))
4189 if (
d->mouseGrabberItems.isEmpty()) {
4193 d->dispatchHoverEvent(&hover);
4196 d->mousePressEventHandler(mouseEvent);
4214 if (
d->mouseGrabberItems.isEmpty()) {
4219 mouseEvent->
setAccepted(
d->dispatchHoverEvent(&hover));
4224 d->sendMouseEvent(mouseEvent);
4244 if (
d->mouseGrabberItems.isEmpty()) {
4250 d->sendMouseEvent(mouseEvent);
4255 if (!
d->mouseGrabberItems.isEmpty()) {
4256 d->lastMouseGrabberItem =
d->mouseGrabberItems.last();
4257 if (
d->lastMouseGrabberItemHasImplicitMouseGrab)
4258 d->mouseGrabberItems.last()->ungrabMouse();
4260 d->lastMouseGrabberItem = 0;
4266 d->dispatchHoverEvent(&hoverEvent);
4290 d->mousePressEventHandler(mouseEvent);
4314 if (!
d->popupWidgets.isEmpty() && !wheelCandidates.
isEmpty() && wheelCandidates.
first() !=
d->popupWidgets.back() && !
d->popupWidgets.back()->isAncestorOf(wheelCandidates.
first())) {
4323 while (--iter >=
d->popupWidgets.begin() && !wheelCandidates.
isEmpty()) {
4324 if (wheelCandidates.
first() == *iter || (*iter)->isAncestorOf(wheelCandidates.
first()))
4326 d->removePopup(*iter);
4330 bool hasSetFocus =
false;
4344 bool isPanel = item->
isPanel();
4345 d->sendEvent(item, wheelEvent);
4365 d->sendEvent(
d->focusItem, event);
4386 if (
d->painterStateProtection)
4390 if (
d->painterStateProtection)
4413 if (
d->painterStateProtection)
4417 if (
d->painterStateProtection)
4424 bool useWindowOpacity,
bool painterStateProtection)
4427 item->
paint(painter, option, widget);
4432 const qreal windowOpacity = (proxy && proxy->
widget() && useWindowOpacity)
4439 if (windowOpacity < 1.0)
4440 painter->
setOpacity(oldPainterOpacity * windowOpacity);
4448 if (painterStateProtection)
4451 if (painterStateProtection)
4457 widgetItem->
paint(painter, option, widget);
4462 if (windowOpacity < 1.0)
4467 const QTransform &itemToPixmap, QPainter::RenderHints renderHints,
4477 pixmapPainter.
begin(pix);
4481 pixmapPainter.
begin(&subPix);
4483 if (!pixmapExposed.
isEmpty()) {
4495 _q_paintItem(item, &pixmapPainter, option, 0,
false, painterStateProtection);
4496 pixmapPainter.
end();
4500 pixmapPainter.
begin(pix);
4504 pixmapPainter.
end();
4521 if (m11 == 0.0f && m22 == 0.0f) {
4522 if (m12 == 1.0f && m21 == -1.0f)
4524 else if (m12 == -1.0f && m21 == 1.0f)
4526 else if (m12 == -1.0f && m21 == -1.0f)
4528 else if (m12 == 1.0f && m21 == 1.0f)
4545 bool painterStateProtection)
4553 || !
X11->use_xrender
4556 _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget,
true, painterStateProtection);
4561 qreal newPainterOpacity = oldPainterOpacity;
4563 if (proxy && proxy->
widget()) {
4565 if (windowOpacity < 1.0)
4566 newPainterOpacity *= windowOpacity;
4571 QRectF adjustedBrect(brect);
4582 pixmapKey = itemCache->
key;
4584 pixmapKey = itemCache->
deviceData.value(widget).key;
4593 bool fixedCacheSize =
false;
4598 pixmapSize = br.
size();
4603 QSize adjustSize(adjust*2, adjust*2);
4604 br.
adjust(-adjust, -adjust, adjust, adjust);
4605 if (pix.
isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) != pix.
size())) {
4606 pix =
QPixmap(pixmapSize + adjustSize);
4626 if (fixedCacheSize) {
4628 itemToPixmap.
scale(scale.x(), scale.y());
4634 styleOptionTmp = *option;
4638 for (
int i = 0; i < itemCache->
exposed.
size(); ++i) {
4641 pixmapExposed += itemToPixmap.
mapRect(r).toAlignedRect();
4644 exposedRect = brect;
4646 styleOptionTmp.exposedRect = exposedRect;
4650 &styleOptionTmp, painterStateProtection);
4663 if (newPainterOpacity != oldPainterOpacity) {
4681 if (widget && !viewRect.
intersects(deviceRect))
4686 QSize maximumCacheSize =
4688 if (!maximumCacheSize.
isEmpty()
4689 && (deviceRect.
width() > maximumCacheSize.
width()
4691 _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget,
4692 oldPainterOpacity != newPainterOpacity, painterStateProtection);
4699 bool pixModified =
false;
4701 bool invertable =
true;
4706 bool allowPartialCacheExposure =
false;
4709 if (!simpleTransform) {
4715 }
else if (!viewRect.
isNull()) {
4721 if (!allowPartialCacheExposure && !viewRect.
isNull() && !viewRect.
contains(deviceRect)) {
4722 allowPartialCacheExposure = (viewRect.
width() * 1.2 < deviceRect.
width())
4727 if (allowPartialCacheExposure) {
4732 int dx = deviceRect.
left() < viewRect.
left() ? viewRect.
left() - deviceRect.
left() : 0;
4733 int dy = deviceRect.
top() < viewRect.
top() ? viewRect.
top() - deviceRect.
top() : 0;
4734 QPoint newCacheIndent(dx, dy);
4735 deviceRect &= viewRect;
4755 newPixPainter.
end();
4758 exposed += newPix.rect();
4761 scrollExposure = exposed;
4772 if (deviceRect.
size() != pix.
size()) {
4795 QRegion pixmapExposed = scrollExposure;
4798 for (
int i = 0; i < exposed.
size(); ++i)
4799 pixmapExposed += itemToPixmap.
mapRect(exposed.
at(i)).toRect().
adjusted(-1, -1, 1, 1);
4808 for (
int i = 0; i < exposed.
size(); ++i)
4809 br |= exposed.
at(i);
4812 br |= pixmapToItem.
mapRect(r);
4814 styleOptionTmp = *option;
4819 &styleOptionTmp, painterStateProtection);
4836 if (newPainterOpacity != oldPainterOpacity) {
4852 if (!unpolishedItems.isEmpty())
4860 exposedSceneRect = viewTransform->
inverted().
mapRect(exposedSceneRect);
4863 for (
int i = 0; i < tli.
size(); ++i)
4864 drawSubtreeRecursive(tli.
at(i), painter, viewTransform, exposedRegion,
widget);
4879 if (!itemHasContents && !itemHasChildren)
4889 bool translateOnlyTransform =
false;
4890 #define ENSURE_TRANSFORM_PTR \ 4891 if (!transformPtr) { \ 4892 Q_ASSERT(!itemIsUntransformable); \ 4893 if (viewTransform) { \ 4894 transform = item->d_ptr->sceneTransform; \ 4895 transform *= *viewTransform; \ 4896 transformPtr = &transform; \ 4898 transformPtr = &item->d_ptr->sceneTransform; \ 4899 translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; \ 4905 bool wasDirtyParentSceneTransform =
false;
4907 if (itemIsUntransformable) {
4909 transformPtr = &transform;
4913 wasDirtyParentSceneTransform =
true;
4917 bool drawItem = itemHasContents && !itemIsFullyTransparent;
4921 QRect viewBoundingRect = translateOnlyTransform ? brect.
translated(transformPtr->
dx(), transformPtr->
dy()).toAlignedRect()
4922 : transformPtr->
mapRect(brect).toAlignedRect();
4923 viewBoundingRect.
adjust(-
int(rectAdjust), -
int(rectAdjust), rectAdjust, rectAdjust);
4926 drawItem = exposedRegion ? exposedRegion->
intersects(viewBoundingRect)
4927 : !viewBoundingRect.normalized().isEmpty();
4929 if (!itemHasChildren)
4931 if (itemClipsChildrenToShape) {
4932 if (wasDirtyParentSceneTransform)
4939 if (itemHasChildren && itemClipsChildrenToShape)
4942 #ifndef QT_NO_GRAPHICSEFFECT 4946 painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent);
4952 if (effectTransform)
4979 #endif //QT_NO_GRAPHICSEFFECT 4981 draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity,
4982 effectTransform, wasDirtyParentSceneTransform, drawItem);
5001 if (effectTransform)
5010 bool wasDirtyParentSceneTransform,
bool drawItem)
5015 bool setChildClip = itemClipsChildrenToShape;
5016 bool itemHasChildrenStackedBehind =
false;
5019 if (itemHasChildren) {
5020 if (itemClipsChildrenToShape)
5029 if (itemHasChildrenStackedBehind) {
5030 if (itemClipsChildrenToShape) {
5032 setChildClip =
false;
5038 if (wasDirtyParentSceneTransform)
5044 drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform);
5055 ? *exposedRegion :
QRegion(), exposedRegion == 0);
5058 bool restorePainterClip =
false;
5060 if (!itemHasChildren || !itemClipsChildrenToShape) {
5063 if ((restorePainterClip = itemClipsToShape))
5065 }
else if (itemHasChildrenStackedBehind){
5068 if (itemClipsToShape) {
5074 setChildClip =
true;
5076 }
else if (itemClipsToShape) {
5081 setChildClip =
false;
5084 if (painterStateProtection && !restorePainterClip)
5089 item->
paint(painter, &styleOptionTmp, widget);
5091 drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection);
5093 if (painterStateProtection || restorePainterClip)
5096 static int drawRect =
qgetenv(
"QT_DRAW_SCENE_ITEM_RECTS").
toInt();
5111 if (itemHasChildren) {
5117 if (wasDirtyParentSceneTransform)
5121 drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform);
5125 if (itemClipsChildrenToShape)
5131 bool force,
bool ignoreOpacity,
bool removingItemFromScene,
5132 bool updateBoundingRect)
5157 removingItemFromScene || invalidateChildren,
5172 const bool fullItemUpdate = rect.
isNull();
5173 if (!fullItemUpdate && rect.
isEmpty())
5176 if (!processDirtyItemsEmitted) {
5177 QMetaMethod method = q_ptr->metaObject()->method(processDirtyItemsIndex);
5180 processDirtyItemsEmitted =
true;
5183 if (removingItemFromScene) {
5186 if (isSignalConnected(changedSignalIndex) ||
views.
isEmpty()) {
5194 for (
int i = 0; i <
views.
size(); ++i) {
5204 if (!hasNoContents) {
5211 invalidateChildren =
true;
5214 if (invalidateChildren) {
5224 if (!updateBoundingRect)
5229 const QRectF &rect,
bool itemIsUntransformable)
5237 if (itemIsUntransformable) {
5266 qreal parentOpacity)
5273 resetDirtyItem(item);
5279 resetDirtyItem(item,
true);
5285 if (!itemHasContents) {
5286 if (!itemHasChildren) {
5287 resetDirtyItem(item);
5291 itemHasContents =
true;
5298 resetDirtyItem(item, itemHasChildren);
5304 if (wasDirtyParentSceneTransform && !itemIsUntransformable) {
5310 if (itemIsFullyTransparent || !itemHasContents || dirtyAncestorContainsChildren) {
5315 if (itemIsFullyTransparent || !itemHasContents)
5331 const bool useCompatUpdate =
views.
isEmpty() || isSignalConnected(changedSignalIndex);
5348 bool uninitializedDirtyRect =
true;
5350 for (
int j = 0; j <
views.
size(); ++j) {
5359 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5365 if (!viewPrivate->
updateRect(paintedViewBoundingRect))
5366 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5373 && paintedViewBoundingRect.
x() == -1 && paintedViewBoundingRect.
y() == -1
5374 && paintedViewBoundingRect.
width() == -1 && paintedViewBoundingRect.
height() == -1) {
5378 if (uninitializedDirtyRect) {
5379 dirtyRect = itemBoundingRect;
5384 uninitializedDirtyRect =
false;
5392 paintedViewBoundingRect =
QRect(-1, -1, -1, -1);
5405 const bool bypassUpdateClip = !itemHasContents && wasDirtyParentViewBoundingRects;
5406 if (itemClipsChildrenToShape && !bypassUpdateClip) {
5409 views.
at(i)->d_func()->setUpdateClip(item);
5411 if (!dirtyAncestorContainsChildren) {
5413 && itemClipsChildrenToShape;
5420 if (wasDirtyParentSceneTransform)
5422 if (wasDirtyParentViewBoundingRects)
5424 if (parentIgnoresVisible)
5426 if (parentIgnoresOpacity)
5428 if (allChildrenDirty) {
5434 processDirtyItemsRecursive(child, dirtyAncestorContainsChildren, opacity);
5437 if (itemClipsChildrenToShape) {
5440 views.
at(i)->d_func()->setUpdateClip(0);
5442 }
else if (wasDirtyParentSceneTransform) {
5446 resetDirtyItem(item);
5490 if (!
d->unpolishedItems.isEmpty())
5491 d->_q_polishItems();
5500 const quint32 oldRectAdjust =
d->rectAdjust;
5502 d->updateAll =
false;
5503 expose = &view->d_func()->exposedRegion;
5512 for (
int i = 0; i < numItems; ++i) {
5515 topLevelItems << item;
5517 d->drawSubtreeRecursive(item, painter, &viewTransform, expose, widget);
5521 d->rectAdjust = oldRectAdjust;
5523 for (
int i = 0; i < topLevelItems.
size(); ++i)
5556 if (
d->lastFocusItem && !
d->lastFocusItem->isWidget()) {
5563 if (!
d->tabFocusFirst) {
5571 widget = next ?
d->tabFocusFirst :
d->tabFocusFirst->d_func()->focusPrev;
5574 widget = next ? test->d_func()->focusNext : test->d_func()->focusPrev;
5575 if ((next && widget ==
d->tabFocusFirst) || (!next && widget ==
d->tabFocusFirst->d_func()->focusPrev))
5590 widget = next ? widget->d_func()->focusNext : widget->d_func()->focusPrev;
5591 if ((next && widget ==
d->tabFocusFirst) || (!next && widget ==
d->tabFocusFirst->d_func()->focusPrev))
5593 }
while (widget != widgetThatHadFocus);
5690 if (style ==
d->style)
5695 if ((
d->style = style))
5696 d->style->setParent(
this);
5749 d->setFont_helper(resolvedFont);
5789 d->setPalette_helper(resolvedPalette);
5806 return d->activationRefCount > 0;
5821 return d->activePanel;
5841 d->setActivePanelHelper(item,
false);
5858 if (
d->activePanel &&
d->activePanel->isWindow())
5859 return static_cast<QGraphicsWidget *>(
d->activePanel);
5876 if (widget && widget->
scene() !=
this) {
5877 qWarning(
"QGraphicsScene::setActiveWindow: widget %p must be part of this scene",
5892 if (sibling != panel && sibling->
isWindow())
5893 siblingWindows << sibling;
5898 for (
int i = 0; i < siblingWindows.
size(); ++i)
5926 qWarning(
"QGraphicsScene::sendEvent: cannot send event to a null item");
5929 if (item->
scene() !=
this) {
5930 qWarning(
"QGraphicsScene::sendEvent: item %p's scene (%p)" 5931 " is different from this scene (%p)",
5932 item, item->
scene(),
this);
5935 return d->sendEvent(item, event);
5941 #ifndef QT_NO_GESTURES 5955 for (
int i = 0; i < touchPoints.
count(); ++i) {
5966 int closestTouchPointId = -1;
5970 if (closestTouchPointId == -1|| distance < closestDistance) {
5971 closestTouchPointId = touchPoint.
id();
5975 return closestTouchPointId;
5991 item = itemForTouchPointId.isEmpty()
5993 : itemForTouchPointId.constBegin().value();
6000 sceneTouchEvent->
widget());
6001 item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.first();
6006 int closestTouchPointId = findClosestTouchPointId(touchPoint.
scenePos());
6007 QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId);
6008 if (!item || (closestItem && cachedItemsUnderMouse.contains(closestItem)))
6014 itemForTouchPointId.insert(touchPoint.
id(), item);
6015 sceneCurrentTouchPoints.insert(touchPoint.
id(), touchPoint);
6017 item = itemForTouchPointId.take(touchPoint.
id());
6021 sceneCurrentTouchPoints.remove(touchPoint.
id());
6023 item = itemForTouchPointId.value(touchPoint.
id());
6026 Q_ASSERT(sceneCurrentTouchPoints.contains(touchPoint.
id()));
6027 sceneCurrentTouchPoints[touchPoint.
id()] = touchPoint;
6030 StatesAndTouchPoints &statesAndTouchPoints = itemsNeedingEvents[item];
6031 statesAndTouchPoints.first |= touchPoint.
state();
6032 statesAndTouchPoints.second.append(touchPoint);
6035 if (itemsNeedingEvents.
isEmpty()) {
6036 sceneTouchEvent->
accept();
6040 bool ignoreSceneTouchEvent =
true;
6043 for (; it !=
end; ++
it) {
6050 switch (it.
value().first) {
6075 switch (touchEvent.
type()) {
6081 bool res = sendTouchBeginEvent(item, &touchEvent)
6087 itemForTouchPointId.remove(touchPoint.
id());
6088 sceneCurrentTouchPoints.remove(touchPoint.
id());
6090 ignoreSceneTouchEvent =
false;
6096 updateTouchPointsForItem(item, &touchEvent);
6098 ignoreSceneTouchEvent =
false;
6103 sceneTouchEvent->
setAccepted(ignoreSceneTouchEvent);
6110 if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.first() != origin) {
6112 cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.
screenPos().
toPoint(),
6145 bool eventAccepted = touchEvent->
isAccepted();
6148 updateTouchPointsForItem(item, touchEvent);
6151 res = acceptTouchEvents &&
sendEvent(item, touchEvent);
6159 touchEvent->spont =
false;
6160 if (res && eventAccepted) {
6164 itemForTouchPointId[touchPoint.
id()] = item;
6185 views.
at(i)->d_func()->updateInputMethodSensitivity();
6202 for (
int i = 0; i < items.
count(); ++i) {
6205 blockedPanels.
insert(item);
6213 modalPanels.removeAll(panel);
6216 modalPanels.prepend(panel);
6218 if (!hoverItems.isEmpty()) {
6222 dispatchHoverEvent(&hoverEvent);
6225 if (!mouseGrabberItems.isEmpty() && lastMouseGrabberItemHasImplicitMouseGrab) {
6228 ungrabMouse(item,
false);
6233 for (
int i = 0; i < items.
count(); ++i) {
6255 for (
int i = 0; i < items.
count(); ++i) {
6258 blockedPanels.insert(item);
6261 modalPanels.removeAll(panel);
6264 for (
int i = 0; i < items.
count(); ++i) {
6273 dispatchHoverEvent(&hoverEvent);
6276 #ifndef QT_NO_GESTURES 6285 foreach (
QGesture *gesture, gestures) {
6290 for (
int j = 0; j < items.
size(); ++j) {
6302 if (normalGestures.
contains(gesture)) {
6303 normalGestures.
remove(gesture);
6305 conflicts->
insert(gesture);
6307 normalGestures.
insert(gesture);
6310 (*targets)[itemobj].insert(gesture);
6312 (*itemsSet).insert(itemobj);
6321 *normal = normalGestures;
6326 QWidget *viewport =
event->widget();
6334 G_DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:" 6335 <<
"Gestures:" << allGestures;
6341 foreach (
QGesture *gesture, allGestures) {
6344 gesture->d_func()->sceneHotSpot = toScene.
map(gesture->
hotSpot());
6346 gesture->d_func()->sceneHotSpot =
QPointF();
6354 startedGestures.
insert(gesture);
6358 if (!startedGestures.
isEmpty()) {
6361 gestureTargetsAtHotSpots(startedGestures,
Qt::GestureFlag(0), &cachedItemGestures, 0,
6362 &normalGestures, &conflictedGestures);
6363 cachedTargetItems = cachedItemGestures.keys();
6365 G_DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:" 6366 <<
"Normal gestures:" << normalGestures
6367 <<
"Conflicting gestures:" << conflictedGestures;
6371 if (!conflictedGestures.isEmpty()) {
6372 for (
int i = 0; i < cachedTargetItems.size(); ++i) {
6380 G_DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:" 6381 <<
"delivering override to" 6382 << item.
data() << gestures;
6386 ev.setWidget(event->
widget());
6390 ev.setAccepted(g,
false);
6394 if (ev.isAccepted() || ev.isAccepted(g)) {
6395 conflictedGestures.remove(g);
6398 gestureTargets.insert(g, item.
data());
6400 it = cachedItemGestures.
begin();
6401 e = cachedItemGestures.
end();
6402 for(; it != e; ++
it)
6403 it.
value().remove(g);
6404 cachedItemGestures[item.
data()].insert(g);
6406 G_DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:" 6407 <<
"override was accepted:" 6408 << g << item.
data();
6413 if (!gestureTargets.contains(g) && item)
6414 gestureTargets.insert(g, item.
data());
6417 if (conflictedGestures.isEmpty())
6423 if (!normalGestures.
isEmpty()) {
6424 for (
int i = 0; i < cachedTargetItems.size() && !normalGestures.
isEmpty(); ++i) {
6428 foreach (
QGesture *g, cachedItemGestures.value(item)) {
6429 if (!gestureTargets.contains(g)) {
6430 gestureTargets.insert(g, item);
6431 normalGestures.
remove(g);
6442 foreach (
QGesture *gesture, allGestures) {
6444 cachedItemGestures[target].
insert(gesture);
6445 cachedTargetItems.append(target);
6446 undeliveredGestures.
insert(gesture);
6450 parentPropagatedGestures.
insert(gesture);
6452 G_DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:" 6453 <<
"no target for" << gesture <<
"at" 6454 << gesture->
hotSpot() << gesture->d_func()->sceneHotSpot;
6458 for (
int i = 0; i < cachedTargetItems.size(); ++i) {
6461 undeliveredGestures & cachedItemGestures.value(receiver.
data());
6462 gestures -= cachedAlreadyDeliveredGestures.value(receiver.
data());
6467 cachedAlreadyDeliveredGestures[receiver.
data()] += gestures;
6470 G_DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:" 6472 << receiver.
data() << gestures;
6478 if (!ev.isAccepted() && !ev.isAccepted(g)) {
6484 if (receiver && receiver.
data() == gestureTargets.value(g, 0))
6485 ignoredGestures.
insert(g);
6490 gestureTargets[g] = receiver.
data();
6492 undeliveredGestures.
remove(g);
6495 if (undeliveredGestures.
isEmpty())
6500 if (!ignoredGestures.isEmpty() && !isPanel) {
6509 it != ignoredGestures.end();) {
6510 if (parentPropagatedGestures.
contains(*
it)) {
6516 if (item->d_func()->gestureContext.
contains(gestureType)) {
6518 cachedItemGestures[obj].insert(gesture);
6526 it = ignoredGestures.erase(
it);
6534 &cachedItemGestures, &targetsSet, 0, 0);
6536 cachedTargetItems = targetsSet.
toList();
6538 G_DEBUG() <<
"QGraphicsScenePrivate::gestureEventHandler:" 6539 <<
"new targets:" << cachedTargetItems;
6545 foreach (
QGesture *g, startedGestures) {
6547 G_DEBUG() <<
"lets try to cancel some";
6549 cancelGesturesForChildren(g);
6554 foreach (
QGesture *g, allGestures) {
6555 switch (g->
state()) {
6558 gestureTargets.remove(g);
6565 cachedTargetItems.clear();
6566 cachedItemGestures.clear();
6567 cachedAlreadyDeliveredGestures.clear();
6573 QGraphicsItem *originalItem = gestureTargets.value(original);
6574 if (originalItem == 0)
6582 while (iter != gestureTargets.end()) {
6585 if (item != originalItem && originalItem->
isAncestorOf(item)) {
6586 G_DEBUG() <<
" found a gesture to cancel" << iter.
key();
6588 canceledGestures << iter.
key();
6596 while (!almostCanceledGestures.
isEmpty()) {
6599 setIter = almostCanceledGestures.
begin();
6601 while (setIter != almostCanceledGestures.
end()) {
6605 if (target == item) {
6606 gestures << *setIter;
6607 setIter = almostCanceledGestures.
erase(setIter);
6628 for (
int j = 0; j < items.
size(); ++j) {
6647 for (setIter = canceledGestures.
begin(); setIter != canceledGestures.
end(); ++setIter) {
6648 gestureManager->
recycle(*setIter);
6649 gestureTargets.remove(*setIter);
6656 if (!grabbedGestures[gesture]++) {
6668 if (!--grabbedGestures[gesture]) {
6673 #endif // QT_NO_GESTURES 6677 #include "moc_qgraphicsscene.cpp" 6679 #endif // QT_NO_GRAPHICSVIEW void setStickyFocus(bool enabled)
The QVariant class acts like a union for the most common Qt data types.
void unregisterScenePosItem(QGraphicsItem *item)
quint32 processDirtyItemsEmitted
T qobject_cast(QObject *object)
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse release...
Qt::DropAction dropAction() const
Returns the action that was performed in this drag and drop.
const QMimeData * mimeData() const
This function returns the MIME data of the event.
The QPainter class performs low-level painting on widgets and other paint devices.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
The QColor class provides colors based on RGB, HSV or CMYK values.
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
void setSource(QWidget *source)
This function set the source widget, i.
QGraphicsWidget * activeWindow() const
Returns the current active window, or 0 if no window is currently active.
void setFont(const QFont &font)
Sets the font that is used to draw the item's text to font.
void setScenePos(const QPointF &pos)
Sets the scene position of the mouse to pos.
bool updateRectF(const QRectF &rect)
QRectF growingItemsBoundingRect
quint32 dirtyGrowingItemsBoundingRect
void clear()
Removes and deletes all items from the scene, but otherwise leaves the state of the scene unchanged...
QMap< int, QGraphicsItem * > itemForTouchPointId
qreal height() const
This convenience function is equivalent to calling sceneRect().
int id() const
Returns the id number of this touch point.
void squeeze()
Releases any memory not required to store the items.
static QRectF adjustedItemBoundingRect(const QGraphicsItem *item)
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
QMap< Qt::MouseButton, QPoint > mouseGrabberButtonDownScreenPos
void setSelectionArea(const QPainterPath &path)
Sets the selection area to path.
const Key & key() const
Returns the current item's key as a const reference.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items...
QPointF scenePos() const
Returns the position of the mouse cursor in scene coordinates at the moment the help event was sent...
void setPen(const QPen &pen)
Sets the item's pen to pen.
ItemIndexMethod itemIndexMethod() const
void setLastPos(const QPointF &lastPos)
QMap< QPaintDevice *, DeviceData > deviceData
bool itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static void _q_paintItem(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, bool useWindowOpacity, bool painterStateProtection)
The QKeyEvent class describes a key event.
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
QPoint screenPos() const
Returns the mouse cursor position in screen coordinates.
QList< QGraphicsItem * > keyboardGrabberItems
virtual bool sceneEvent(QEvent *event)
This virtual function receives events to this item.
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
qreal combineOpacityFromParent(qreal parentOpacity) const
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
static void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, const QTransform *effectTransform)
quint32 holesInTopLevelSiblingIndex
virtual void dropEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drop events for th...
void setBspTreeDepth(int depth)
void removeView(QGraphicsView *view)
QIntegerForSizeof< void * >::Unsigned quintptr
QGraphicsItem * focusItem() const
If this item, a child or descendant of this item currently has input focus, this function will return...
static mach_timebase_info_data_t info
QGraphicsItem * commonAncestorItem(const QGraphicsItem *other) const
Returns the closest common ancestor item of this item and other, or 0 if either other is 0...
static QRectF adjustedItemEffectiveBoundingRect(const QGraphicsItem *item)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
QPointF mapToScene(const QPoint &point) const
Returns the viewport coordinate point mapped to scene coordinates.
void addView(QGraphicsView *view)
QGraphicsWidget * parentWidget() const
Returns a pointer to the item's parent widget.
bool isTransformed() const
Returns true if the view is transformed (i.
qreal opacity() const
Returns the opacity of the painter.
void recycle(QGesture *gesture)
#define QT_END_NAMESPACE
This macro expands to.
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
QPointF toPointF() const
Returns the variant as a QPointF if the variant has type() Point or PointF ; otherwise returns a null...
void setModifiers(Qt::KeyboardModifiers modifiers)
QPointF startScenePos() const
Returns the starting scene position of this touch point.
bool acceptDrops() const
Returns true if this item can accept drag and drop events; otherwise, returns false.
QGraphicsItem::PanelModality panelModality
bool isWindow() const
Returns true if the item is a QGraphicsWidget window, otherwise returns false.
QPointer< QWidget > widget
virtual void advance(int phase)
This virtual function is called twice for all items by the QGraphicsScene::advance() slot...
QSize size() const
Returns the size of the pixmap.
int findClosestTouchPointId(const QPointF &scenePos)
void removeFromGroup(QGraphicsItem *item)
Removes the specified item from this group.
Qt::TouchPointState state() const
Returns the current state of this touch point.
void advance()
This slot advances the scene by one step, by calling QGraphicsItem::advance() for all items on the sc...
void resetFocusProxy()
Sets the focusProxy pointer to 0 for all items that have this item as their focusProxy.
int remove(const Key &key)
Removes all the items that have the key from the hash.
QScopedPointer< QGraphicsItemPrivate > d_ptr
static void keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1)
void setLastPos(const QPointF &pos)
void remove(int i)
Removes the element at index position i.
void enableTouchEventsOnViews()
void setSelected(bool selected)
If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
virtual void drawBackground(QPainter *painter, const QRectF &rect)
Draws the background of the scene using painter, before any items and the foreground are drawn...
bool dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEvent)
This event handler, for event hoverEvent, can be reimplemented in a subclass to receive hover enter e...
virtual void focusInEvent(QFocusEvent *event)
This event handler, for event focusEvent, can be reimplemented in a subclass to receive focus in even...
void setFocus(Qt::FocusReason focusReason=Qt::OtherFocusReason)
Sets focus on the scene by sending a QFocusEvent to the scene, passing focusReason as the reason...
virtual void helpEvent(QGraphicsSceneHelpEvent *event)
This event handler, for event helpEvent, can be reimplemented in a subclass to receive help events...
T * data() const
Returns the value of the pointer referenced by this object.
void setRect(const QRectF &rect)
void setFont(const QFont &font)
Sets the font used to render the text item to font.
#define it(className, varName)
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos)
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
void setScreenPos(const QPoint &pos)
void setScenePosItemEnabled(QGraphicsItem *item, bool enabled)
virtual QRectF boundingRect() const =0
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
void setMimeData(const QMimeData *data)
This function sets the MIME data for the event.
QMap< Key, T >::iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
QList< QGraphicsItem * > itemsAtPosition(const QPoint &screenPos, const QPointF &scenePos, QWidget *widget) const
Returns all items for the screen position in event.
void clearFocus()
Takes keyboard input focus from the item.
bool remove(const T &value)
QPoint screenPos() const
Returns the position of the mouse cursor in screen coordinates at the moment the hover event was sent...
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...
virtual void updateSceneTransformFromParent()
QGraphicsItem * focusItem
void grabKeyboard(QGraphicsItem *item)
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
static bool updateHelper(QGraphicsViewPrivate *view, QGraphicsItemPrivate *item, const QRectF &rect, bool itemIsUntransformable)
void setAccepted(bool accepted)
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, h (hue), s (saturation), v (value), and a (alpha-channel, i.e.
static bool transformIsSimple(const QTransform &transform)
The QPointF class defines a point in the plane using floating point precision.
void clearFocus()
Clears focus from the scene.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
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 ...
QTransform lastEffectTransform
void grabGesture(QGraphicsItem *, Qt::GestureType gesture)
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...
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
bool isVisible() const
Returns true if the item is visible; otherwise, false is returned.
bool filterEvent(QWidget *receiver, QEvent *event)
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
void restore()
Restores the current painter state (pops a saved state off the stack).
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
QList< QGraphicsItem * > modalPanels
Qt::MouseButton button() const
Returns the mouse button (if any) that caused the event.
The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene.
QGesture::GestureCancelPolicy gestureCancelPolicy
the policy for deciding what happens on accepting a gesture
int left() const
Returns the x-coordinate of the rectangle's left edge.
Qt::MouseButtons buttons() const
Returns a Qt::MouseButtons value indicating which buttons were pressed on the mouse when this mouse e...
The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for disco...
int width() const
Returns the width of the rectangle.
QPointF genericMapFromScene(const QPointF &pos, const QWidget *viewport) const
Maps the point pos from scene to item coordinates.
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
bool isBlockedByModalPanel(QGraphicsItem **blockingPanel=0) const
Returns true if this item is blocked by a modal panel, false otherwise.
void ensureSortedChildren()
The QGraphicsEffectSource class represents the source on which a QGraphicsEffect is installed on...
void setFont(const QFont &font)
void setButtonDownPos(Qt::MouseButton button, const QPointF &pos)
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drag enter events ...
QList< QGraphicsItem * > items() const
Returns a list of all items in the scene in descending stacking order.
QList< QGraphicsItem * > cachedItemsUnderMouse
static QApplicationPrivate * instance()
QWidget * widget() const
Returns the widget where the event originated, or 0 if the event originates from another application...
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...
QPointF lastScenePos() const
Returns the scene position of this touch point from the previous touch event.
int count(const T &t) const
Returns the number of occurrences of value in the list.
static QPalette palette()
Returns the application palette.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifiers that were pressed when the drag and drop event was created...
QRect boundingRect() const
Returns the bounding rectangle of this region.
QVector< QGraphicsItem * > unpolishedItems
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.
static QStyle * style()
Returns the application's style object.
void setButtons(Qt::MouseButtons buttons)
iterator find(const Key &key)
Returns an iterator pointing to the item with key key in the map.
void addItem(QGraphicsItem *item)
Adds or moves the item and all its childen to this scene.
bool isOpacityNull() const
T & value() const
Returns a modifiable reference to the current item's value.
QGraphicsSceneIndex * index
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse press e...
void setScenePos(const QPointF &pos)
void setWidget(QWidget *widget)
Sets the widget related to this event.
int height() const
Returns the height of the rectangle.
void destroyItemGroup(QGraphicsItemGroup *group)
Reparents all items in group to group's parent item, then removes group from the scene, and finally deletes it.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
QRectF toRectF() const
Returns the variant as a QRectF if the variant has type() Rect or RectF ; otherwise returns an invali...
static void updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent)
QPointF scenePos() const
Returns the scene position of this touch point.
The QHash class is a template class that provides a hash-table-based dictionary.
QGraphicsItem * mouseGrabberItem() const
Returns the current mouse grabber item, or 0 if no item is currently grabbing the mouse...
PanelModality panelModality() const
Returns the modality for this item.
void removeSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter)
qint64 horizontalScroll() const
Returns the horizontal scroll value (the X value of the left edge of the viewport).
bool isEnabled() const
Returns true if the item is enabled; otherwise, false is returned.
The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display form...
QSet< QGraphicsItem * > scenePosItems
The QObject class is the base class of all Qt objects.
void invalidateScene(const QRectF &rect=QRectF(), QGraphicsScene::SceneLayers layers=QGraphicsScene::AllLayers)
Invalidates and schedules a redraw of layers inside rect.
void cleanupCachedGestures(QObject *target, Qt::GestureType type)
virtual void keyPressEvent(QKeyEvent *event)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive keypress events...
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
bool isSelected() const
Returns true if this item is selected; otherwise, false is returned.
The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene.
bool focusNextPrevChild(bool next)
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it cannot.
static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &pixmapExposed, const QTransform &itemToPixmap, QPainter::RenderHints renderHints, const QStyleOptionGraphicsItem *option, bool painterStateProtection)
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setBrushOrigin(int x, int y)
Sets the brush's origin to point (x, y).
void setTouchPointStates(Qt::TouchPointStates aTouchPointStates)
Sets a bitwise OR of all the touch point states for this event.
void setStartPos(const QPointF &startPos)
quint32 dirtySceneTransform
virtual int devType() const
The QSizeF class defines the size of a two-dimensional object using floating point precision...
void storeMouseButtonsForMouseGrabber(QGraphicsSceneMouseEvent *event)
static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent)
QMap< Qt::MouseButton, QPointF > mouseGrabberButtonDownScenePos
QRectF sceneRect() const
Returns the rect for this touch point in scene coordinates.
static QGestureManager * instance()
virtual QPainterPath shape() const
Returns the shape of this item as a QPainterPath in local coordinates.
int rectCount() const
Returns the number of rectangles that will be returned in rects().
const T value(const Key &key) const
Returns the value associated with the key.
bool eventFilter(QObject *watched, QEvent *event)
QGraphicsScene filters QApplication's events to detect palette and font changes.
void cloneDragDropEvent(QGraphicsSceneDragDropEvent *dest, QGraphicsSceneDragDropEvent *source)
void setForegroundBrush(const QBrush &brush)
void save()
Saves the current painter state (pushes the state onto a stack).
bool sendEvent(QGraphicsItem *item, QEvent *event)
Sends event event to item item through possible event filters.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void gestureEventHandler(QGestureEvent *event)
QSet< QGraphicsItem * > selectedItems
static QPixmap * find(const QString &key)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
qreal x() const
Returns the x-coordinate of this point.
void sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent)
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false...
void setFont_helper(const QFont &font)
Set the font and propagate the changes if the font is different from the current font.
static QFont font()
Returns the default application font.
QTransform viewportTransform() const
Returns a matrix that maps viewport coordinates to scene coordinates.
void registerScenePosItem(QGraphicsItem *item)
The QLineF class provides a two-dimensional vector using floating point precision.
QList< QGraphicsView * > views
quint32 acceptedTouchBeginEvent
virtual void removeItem(QGraphicsItem *item)=0
This pure virtual function removes an item to the scene index.
qreal zValue() const
Returns the Z-value of the item.
T & value() const
Returns a modifiable reference to the current item's value.
QBrush backgroundBrush() const
Qt::CoordinateSystem currentCachedSystem() const
QGraphicsItem * passiveFocusItem
static void setClip(QPainter *painter, QGraphicsItem *item)
QPointF buttonDownScenePos(Qt::MouseButton button) const
Returns the mouse cursor position in scene coordinates where the specified button was clicked...
static const QRectF boundingRect(const QPointF *points, int pointCount)
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
void drawItemHelper(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, bool painterStateProtection)
Draws items directly, or using cache.
const Key & key() const
Returns the current item's key.
QGraphicsItem * dragDropItem
QPointF lastScenePos() const
Returns the last recorded, the scene coordinates of the previous mouse or hover event received by the...
bool removeOne(const T &t)
Removes the first occurrence of value in the list and returns true on success; otherwise returns fals...
void clearKeyboardGrabber()
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.
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.
quint32 hasBoundingRegionGranularity
void invalidateCache(InvalidateReason reason=SourceChanged) const
QGraphicsLineItem * addLine(const QLineF &line, const QPen &pen=QPen())
Creates and adds a line item to the scene, and returns the item pointer.
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item1 is on top of item2.
QRectF boundingRect(Qt::CoordinateSystem system) const
int width() const
Returns the width.
QWidget * source() const
This function returns the QGraphicsView that created the QGraphicsSceneDragDropEvent.
void ungrabMouse(QGraphicsItem *item, bool itemIsDying=false)
void append(const T &t)
Inserts value at the end of the list.
void updateFont(const QFont &font)
Update the font, and whether or not it has changed, reresolve all fonts in the scene.
void ungrabGesture(QGraphicsItem *, Qt::GestureType gesture)
static void _q_adjustRect(QRect *rect)
void mousePress(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=0, QPoint pos=QPoint(), int delay=-1)
Simulates pressing a mouse button with an optional modifier on a widget.
void sceneRectChanged(const QRectF &rect)
This signal is emitted by QGraphicsScene whenever the scene rect changes.
QPointF lastScenePos() const
Returns the last recorded mouse cursor position in scene coordinates.
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler, for event keyEvent, can be reimplemented in a subclass to receive key release eve...
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setZValue(qreal z)
Sets the Z-value of the item to z.
int bspTreeDepth
the depth of the BSP index tree
void setBackgroundBrush(const QBrush &brush)
The QGestureEvent class provides the description of triggered gestures.
bool filterDescendantEvent(QGraphicsItem *item, QEvent *event)
The QRectF class defines a rectangle in the plane using floating point precision. ...
void removePopup(QGraphicsWidget *widget, bool itemIsDying=false)
Remove widget from the popup list.
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
void markDirty(QGraphicsItem *item, const QRectF &rect=QRectF(), bool invalidateChildren=false, bool force=false, bool ignoreOpacity=false, bool removingItemFromScene=false, bool updateBoundingRect=false)
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene's current focus item, or 0 if no item curr...
QList< QGraphicsItem * > mouseGrabberItems
void setPos(const QPointF &pos)
DragMode dragMode
the behavior for dragging the mouse over the scene while the left mouse button is pressed...
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifiers at the moment the hover event was sent.
QWidget * widget() const
Returns the widget on which the event occurred.
quint32 fullUpdatePending
void setPossibleActions(Qt::DropActions actions)
Sets the possible drop actions that the drag can result in to actions.
int lastIndexOf(const T &t, int from=-1) const
Returns the index position of the last occurrence of value in the list, searching backward from index...
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse move ev...
QGraphicsView::ViewportUpdateMode viewportUpdateMode
QList< QGraphicsView * > views() const
Returns a list of all the views that display this scene.
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse doublec...
bool contains(const T &value) const
void resolvePalette()
Resolve the scene's palette against the application palette, and propagate the changes too all items ...
QList< T > toList() const
QStyle * style() const
Returns the scene's style, or the same as QApplication::style() if the scene has not been explicitly ...
QTouchEvent::DeviceType deviceType() const
Returns the touch device Type, which is of type QTouchEvent::DeviceType {DeviceType}.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void invalidateChildrenSceneTransform()
void setDropAction(Qt::DropAction action)
This function lets the receiver of the drop set the drop action that was performed to action...
void removeItem(QGraphicsItem *item)
Removes the item item and all its children from the scene.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
bool itemIsUntransformable() const
QGraphicsTextItem * addText(const QString &text, const QFont &font=QFont())
Creates and adds a text item to the scene, and returns the item pointer.
void updateInputMethodSensitivityInViews()
void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems=false) const
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
QGraphicsItemGroup * createItemGroup(const QList< QGraphicsItem *> &items)
Groups all items in items into a new QGraphicsItemGroup, and returns a pointer to the group...
quint32 fullUpdatePending
void enterModal(QGraphicsItem *item, QGraphicsItem::PanelModality panelModality=QGraphicsItem::NonModal)
void resetCachedContent()
Resets any cached content.
quint32 sceneTransformTranslateOnly
quint32 paintedViewBoundingRectsNeedRepaint
qreal height() const
Returns the height of the rectangle.
virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
Returns true if this item collides with other; otherwise returns false.
void setModifiers(Qt::KeyboardModifiers modifiers)
Sets the modifiers for the current hover event to modifiers.
const T value(const Key &key) const
Returns the value associated with the key key.
void setActiveWindow(QGraphicsWidget *widget)
Activates widget, which must be a widget in this scene.
QGraphicsItem * panel() const
Returns the item's panel, or 0 if this item does not have a panel.
void prepend(const T &t)
Inserts value at the beginning of the list.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
void setPos(const QPointF &pos)
Sets the position of the mouse to pos; this should be relative to the widget that generated the event...
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
QPoint screenPos() const
Returns the position of the cursor in screen coordinates when the wheel event occurred.
void setPos(const QPointF &pos)
QGraphicsEffect * graphicsEffect
The QPolygonF class provides a vector of points using floating point precision.
void setPen(const QPen &pen)
Sets the pen for this item to pen.
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
const T & value() const
Returns the current item's value.
QPoint screenPos() const
Returns the position of the mouse relative to the screen.
Q_CORE_EXPORT void qWarning(const char *,...)
void drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, const QTransform *const, QRegion *exposedRegion, QWidget *widget, qreal parentOpacity=qreal(1.0), const QTransform *const effectTransform=0)
const_iterator insert(const T &value)
void enableMouseTrackingOnViews()
quint32 filtersDescendantEvents
#define ENSURE_TRANSFORM_PTR
bool acceptTouchEvents() const
Returns true if an item accepts touch events; otherwise, returns false.
virtual void inputMethodEvent(QInputMethodEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive input method event...
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...
void updatePalette(const QPalette &palette)
Update the palette, and whether or not it has changed, reresolve all palettes in the scene...
qreal width() const
Returns the width of the rectangle.
void changed(const QList< QRectF > ®ion)
This signal is emitted by QGraphicsScene when control reaches the event loop, if the scene content ch...
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QGraphicsScenePrivate * get(QGraphicsScene *q)
QPointF screenPos() const
Returns the screen position of this touch point.
void setRect(qreal x, qreal y, qreal w, qreal h)
Sets the coordinates of the rectangle's top-left corner to (x, y), and its size to the given width an...
The QRegion class specifies a clip region for a painter.
T value(int i) const
Returns the value at index position i in the list.
const T * ptr(const T &t)
QGraphicsItem * itemAt(const QPointF &pos) const
Returns the topmost visible item at the specified position, or 0 if there are no items at this positi...
QList< Key > keys() const
Returns a list containing all the keys in the map in ascending order.
QGraphicsItem * topLevelItem() const
Returns this item's top-level item.
void setStyle(QStyle *style)
Sets or replaces the style of the scene to style, and reparents the style to this scene...
void clear()
Removes all items from the list.
QList< QGraphicsObject * > cachedTargetItems
const Key & key() const
Returns the current item's key as a const reference.
void drawItems(QPainter *painter, const QTransform *const viewTransform, QRegion *exposedRegion, QWidget *widget)
virtual void resolvePalette(uint inheritedMask)
void setSortCacheEnabled(bool enabled)
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the vector, searching forward from ind...
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
void registerTopLevelItem(QGraphicsItem *item)
GraphicsItemFlags flags() const
Returns this item's flags.
static bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b)
QGraphicsItem * activePanel() const
Returns the current active panel, or 0 if no panel is currently active.
void sendHoverEvent(QEvent::Type type, QGraphicsItem *item, QGraphicsSceneHoverEvent *hoverEvent)
QBrush foregroundBrush() const
void setPalette_helper(const QPalette &palette)
Set the palette and propagate the changes if the palette is different from the current palette...
QVariant extra(Extra type) const
void translate(qreal dx, qreal dy)
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position...
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This event handler, for event contextMenuEvent, can be reimplemented in a subclass to receive context...
QList< QGraphicsItem * > selectedItems() const
Returns a list of all currently selected items.
QSize toSize() const
Returns the variant as a QSize if the variant has type() Size ; otherwise returns an invalid QSize...
bool isSortCacheEnabled() const
qreal boundingRegionGranularity() const
Returns the item's bounding region granularity; a value between and including 0 and 1...
QRect toRect() const
Returns a QRect based on the values of this rectangle.
bool event(QEvent *event)
Processes the event event, and dispatches it to the respective event handlers.
QPoint screenPos() const
Returns the position of the mouse cursor in screen coordinates at the moment the help event was sent...
void qSort(RandomAccessIterator start, RandomAccessIterator end)
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
void installSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter)
void clearSubFocus(QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
const T & at(int i) const
Returns the item at index position i in the vector.
QMap< Qt::MouseButton, QPointF > mouseGrabberButtonDownPos
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
void ensureSequentialTopLevelSiblingIndexes()
Ensures that the list of toplevels is sorted by insertion order, and that the siblingIndexes are pack...
int processDirtyItemsIndex
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, or one of child's parent's ancestors).
QPointF mapFromScene(const QPointF &point) const
Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate sy...
QGraphicsItem * lastActivePanel
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
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...
Qt::DropAction proposedAction() const
Returns the drop action that is proposed, i.e., preferred.
QTransform deviceTransform(const QTransform &viewportTransform) const
Returns this item's device transformation matrix, using viewportTransform to map from scene to device...
void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren=false, qreal parentOpacity=qreal(1.0))
const QBrush & brush() const
Returns the painter's current brush.
Qt::LayoutDirection layoutDirection() const
Returns the layout direction used by the painter when drawing text.
T & first()
Returns a reference to the first item in the list.
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drag move events f...
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
void setRenderHints(RenderHints hints, bool on=true)
Sets the given render hints on the painter if on is true; otherwise clears the render hints...
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QGraphicsWidget * tabFocusFirst
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
int remove(const Key &key)
Removes all the items that have the key key from the map.
bool isActive() const
Returns true if the scene is active (e.
void setCachedOffset(const QPoint &offset)
Qt::DropActions possibleActions() const
Returns the possible drop actions that the drag and drop can result in.
void setActivePanel(QGraphicsItem *item)
Activates item, which must be an item in this scene.
void ensureSequentialSiblingIndex()
Ensures that the list of children is sorted by insertion order, and that the siblingIndexes are packe...
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
OptimizationFlags optimizationFlags
flags that can be used to tune QGraphicsView's performance.
QTransform sceneTransform
bool contains(const Key &key, const T &value) const
Returns true if the map contains an item with key key and value value; otherwise returns false...
The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsSce...
QWidget * widget() const
Returns the widget on which the event occurred.
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
#define Q_ASSERT_X(cond, where, what)
void grabMouse(QGraphicsItem *item, bool implicit=false)
The QGraphicsSceneHelpEvent class provides events when a tooltip is requested.
int top() const
Returns the y-coordinate of the rectangle's top edge.
QGraphicsItem * parentItem() const
Returns a pointer to this item's parent item.
bool isSignalConnected(uint signalIdx) const
Returns true if the signal with index signal_index from object sender is connected.
void selectionChanged()
This signal is emitted by QGraphicsScene whenever the selection changes.
CacheMode
This enum describes QGraphicsItem's cache modes.
void setLastScreenPos(const QPoint &pos)
QPointF scenePos() const
Returns the position of the cursor in scene coordinates when the wheel event occurred.
The QPixmapCache::Key class can be used for efficient access to the QPixmapCache. ...
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
const QTransform & worldTransform() const
Returns the world transformation matrix.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
void setBspTreeDepth(int depth)
void unregisterTopLevelItem(QGraphicsItem *item)
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
The QMap::iterator class provides an STL-style non-const iterator for QMap and QMultiMap.
Type
This enum type defines the valid event types in Qt.
QList< QGraphicsItem * > topLevelItems
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
QPoint lastScreenPos() const
Returns the last recorded mouse cursor position in screen coordinates.
quint32 needSortTopLevelItems
QPointF scenePos() const
Returns the mouse cursor position in scene coordinates.
void leaveModal(QGraphicsItem *item)
void cancelGesturesForChildren(QGesture *original)
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 ...
The QFont class specifies a font used for drawing text.
The QGesture class represents a gesture, containing properties that describe the corresponding user i...
int y() const
Returns the y-coordinate of the rectangle's top edge.
QHash< QGesture *, QGraphicsObject * > gestureTargets
void touchEventHandler(QTouchEvent *touchEvent)
quint32 calledEmitUpdated
bool isPanel() const
Returns true if the item is a panel; otherwise returns false.
QPointF hotSpot
The point that is used to find the receiver for the gesture event.
Qt::GestureType gestureType
the type of the gesture
QRect toRect() const
Returns the variant as a QRect if the variant has type() Rect ; otherwise returns an invalid QRect...
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
void setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent)
quint32 topLevelSequentialOrdering
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
virtual void focusOutEvent(QFocusEvent *event)
This event handler, for event focusEvent, can be reimplemented in a subclass to receive focus out eve...
bool hasFocus() const
Returns true if the scene has focus; otherwise returns false.
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.
bool updateRegion(const QRectF &rect, const QTransform &xform)
QString toolTip() const
Returns the item's tool tip, or an empty QString if no tool tip has been set.
Type type() const
Returns the storage type of the value stored in the variant.
QList< QGraphicsItem * > hoverItems
bool updateRect(const QRect &rect)
void clearSelection()
Clears the current selection.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
int x() const
Returns the x-coordinate of the rectangle's left edge.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
void setPalette(const QPalette &palette)
QObject * parent() const
Returns a pointer to the parent object.
void setLastScenePos(const QPointF &pos)
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
void setDeviceType(DeviceType adeviceType)
Sets the device type to deviceType, which is of type QTouchEvent::DeviceType {DeviceType}.
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
quint32 acceptTouchEvents
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
T & last()
Returns a reference to the last item in the list.
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
const QList< QTouchEvent::TouchPoint > & touchPoints() const
Returns the list of touch points contained in the touch event.
QGraphicsScene(QObject *parent=0)
Constructs a QGraphicsScene object.
int size() const
Returns the number of items in the list.
static bool pathToRect(const QPainterPath &path, QRectF *rect=0)
void setModifiers(Qt::KeyboardModifiers modifiers)
Sets the keyboard modifiers that were pressed when the event was created to modifiers.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
void setWidget(QWidget *widget)
Sets the widget for this event to the widget specified.
quint32 scenePosDescendantsUpdatePending
void setScreenPos(const QPoint &pos)
Sets the position associated with the hover event to the given point in screen coordinates.
QHash< QGraphicsObject *, QSet< QGesture * > > cachedItemGestures
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
QGraphicsWidget * window() const
Returns the item's window, or 0 if this item does not have a window.
void addToGroup(QGraphicsItem *item)
Adds the given item and item's child items to this item group.
void removeItemHelper(QGraphicsItem *item)
Schedules an item for removal.
void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent)
int height() const
Returns the height.
void _q_processDirtyItems()
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded=0) const
void leaveScene(QWidget *viewport)
Handles all actions necessary to clean up the scene when the mouse leaves the view.
bool isWidget() const
Returns true if this item is a widget (i.
virtual void reset()=0
This function can be reimplemented in a subclass to reset the state of the input method.
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
virtual void resolveFont(uint inheritedMask)
QPoint buttonDownScreenPos(Qt::MouseButton button) const
Returns the mouse cursor position in screen coordinates where the specified button was clicked...
virtual bool contains(const QPointF &point) const
Returns true if this item contains point, which is in local coordinates; otherwise, false is returned.
bool isNull() const
Returns true if both the x and y coordinates are set to +0.
bool contains(const Key &key) const
Returns true if the map contains an item with key key; otherwise returns false.
void setButtons(Qt::MouseButtons buttons)
Sets the mouse buttons that were pressed when the event was created to buttons.
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
T qvariant_cast(const QVariant &)
ItemIndexMethod
This enum describes the indexing algorithms QGraphicsScene provides for managing positional informati...
void setProposedAction(Qt::DropAction action)
Sets the proposed action to action.
QGraphicsItem * lastMouseGrabberItem
QVector< QRectF > exposed
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
QPointF scenePos() const
Returns the position of the mouse in scene coordinates.
void setPos(const QPointF &pos)
Sets the position associated with the hover event to the given point in item coordinates.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
friend class QGraphicsSceneBspTreeIndex
QRect rect() const
Returns the pixmap's enclosing rectangle.
QMap< int, QTouchEvent::TouchPoint > sceneCurrentTouchPoints
int y() const
Returns the y coordinate of this point.
static bool is_app_closing
qreal y() const
Returns the y-coordinate of this point.
The QGraphicsItemGroup class provides a container that treats a group of items as a single item...
QPointF scenePos() const
Returns the position of the mouse cursor in scene coordinates at the moment the hover event was sent...
void resolveFont()
Resolve the scene's font against the application font, and propagate the changes too all items in the...
The QPixmap class is an off-screen image representation that can be used as a paint device...
bool intersects(const QRegion &r) const
Returns true if this region intersects with region, otherwise returns false.
QGraphicsItemPaintInfo * info
The TouchPoint class provides information about a touch point in a QTouchEvent.
QScopedPointer< QObjectData > d_ptr
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
QPointF pos() const
Returns the mouse cursor position in item coordinates.
QPointF buttonDownPos(Qt::MouseButton button) const
Returns the mouse cursor position in item coordinates where the specified button was clicked...
virtual ~QGraphicsScene()
Removes and deletes all items from the scene object before destroying the scene object.
bool isAccepted(QGesture *) const
Returns true if the gesture is accepted; otherwise returns false.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
iterator erase(iterator it)
Removes the (key, value) pair pointed to by the iterator pos from the map, and returns an iterator to...
The QGraphicsSceneLinearIndex class provides an implementation of a linear indexing algorithm for dis...
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...
T takeLast()
Removes the last item in the list and returns it.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)=0
This function, which is usually called by QGraphicsView, paints the contents of an item in local coor...
iterator upperBound(const Key &key)
Returns an iterator pointing to the item that immediately follows the last item with key key in the m...
bool isVisibleTo(const QGraphicsItem *parent) const
Returns true if the item is visible to parent; otherwise, false is returned.
QGraphicsEffect::PixmapPadMode currentCachedMode() const
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifiers in use at the time the event was sent.
QList< QRectF > updatedRects
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).
Qt::GestureState state
the current state of the gesture
The QTouchEvent class contains parameters that describe a touch event.
static void remove(const QString &key)
Removes the pixmap associated with key from the cache.
QMap< QWidget *, QRect > paintedViewBoundingRects
The QSize class defines the size of a two-dimensional object using integer point precision.
void addPopup(QGraphicsWidget *widget)
quint32 scenePosDescendants
void setWidget(QWidget *awidget)
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
QGraphicsScene * scene() const
Returns the current scene for the item, or 0 if the item is not stored in a scene.
void gestureTargetsAtHotSpots(const QSet< QGesture *> &gestures, Qt::GestureFlag flag, QHash< QGraphicsObject *, QSet< QGesture *> > *targets, QSet< QGraphicsObject *> *itemsSet=0, QSet< QGesture *> *normal=0, QSet< QGesture *> *conflicts=0)
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
QPainterPath selectionArea() const
Returns the selection area that was previously set with setSelectionArea(), or an empty QPainterPath ...
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...
iterator lowerBound(const Key &key)
Returns an iterator pointing to the first item with key key in the map.
int x() const
Returns the x coordinate of this point.
QGraphicsProxyWidget * addWidget(QWidget *widget, Qt::WindowFlags wFlags=0)
Creates a new QGraphicsProxyWidget for widget, adds it to the scene, and returns a pointer to the pro...
void setLayoutDirection(Qt::LayoutDirection direction)
Sets the layout direction used by the painter when drawing text, to the specified direction...
QPoint lastScreenPos() const
Returns the last recorded mouse cursor position in screen coordinates.
qint64 verticalScroll() const
Returns the vertical scroll value (the X value of the top edge of the viewport).
void ungrabMouse()
Releases the mouse grab.
QGraphicsItemCache * extraItemCache() const
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
QTouchEventSequence touchEvent(QWidget *widget=0, QTouchEvent::DeviceType deviceType=QTouchEvent::TouchScreen)
Creates and returns a QTouchEventSequence for the device deviceType to simulate events for widget...
QGraphicsItem * lastFocusItem
QList< QGraphicsItem * > items() const
Returns a list of all the items in the associated scene, in descending stacking order (i...
quint32 isDeclarativeItem
virtual void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget=0)
Paints the given items using the provided painter, after the background has been drawn, and before the foreground has been drawn.
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
QGraphicsSimpleTextItem * addSimpleText(const QString &text, const QFont &font=QFont())
Creates and adds a QGraphicsSimpleTextItem to the scene, and returns the item pointer.
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive drag leave events ...
QList< QGraphicsItem * > children
void setSceneRect(const QRectF &rect)
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
QRectF translated(qreal dx, qreal dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
QRectF exposedRect
the exposed rectangle, in item coordinates
void _q_updateScenePosDescendants()
void sendDragDropEvent(QGraphicsItem *item, QGraphicsSceneDragDropEvent *dragDropEvent)
PanelModality
This enum specifies the behavior of a modal panel.
void setTouchPoints(const QList< QTouchEvent::TouchPoint > &atouchPoints)
Sets the list of touch points for this event.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
static const KeyPair *const end
void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos)
iterator erase(iterator i)
The QGraphicsObject class provides a base class for all graphics items that require signals...
void markParentDirty(bool updateBoundingRect=false)
void ungrabKeyboard(QGraphicsItem *item, bool itemIsDying=false)
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.
QList< QGraphicsItem * > collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
Returns a list of all items that collide with item.
QGestureManager * gestureManager
bool sendEvent(QGraphicsItem *item, QEvent *event)
This is the final dispatch point for any events from the scene to the item.
void draw(QGraphicsItem *, QPainter *, const QTransform *const, const QTransform *const, QRegion *, QWidget *, qreal, const QTransform *const, bool, bool)
void setButton(Qt::MouseButton button)
QGraphicsPixmapItem * addPixmap(const QPixmap &pixmap)
Creates and adds a pixmap item to the scene, and returns the item pointer.
The QEvent class is the base class of all event classes.
virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event)
Filters events for the item watched.
Type type() const
Returns the event type.
QGraphicsEffectSource * source() const
Returns a pointer to the source, which provides extra context information that can be useful for the ...
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
bool filterEvent(QGraphicsItem *item, QEvent *event)
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
virtual void deleteItem(QGraphicsItem *item)
This method is called when an item has been deleted.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void 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.
void setScreenPos(const QPoint &pos)
Sets the mouse position relative to the screen to pos.
int size() const
Returns the number of items in the vector.
const QBrush & window() const
Returns the window (general background) brush of the current color group.
void resetDirtyItem(QGraphicsItem *item, bool recursive=false)
QGraphicsItem * activePanel
qreal width() const
This convenience function is equivalent to calling sceneRect().
bool hasHotSpot
whether the gesture has a hot-spot
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
QMultiMap< QGraphicsItem *, QGraphicsItem * > sceneEventFilters
QRectF sceneBoundingRect() const
Returns the bounding rect of this item in scene coordinates, by combining sceneTransform() with bound...
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason)
QList< QGraphicsItem * > children() const
Use childItems() instead.
The QFocusEvent class contains event parameters for widget focus events.
void setBrush(const QBrush &brush)
Sets the item's brush to brush.
QPoint toPoint() const
Returns the variant as a QPoint if the variant has type() Point or PointF ; otherwise returns a null ...
QHash< QGraphicsObject *, QSet< QGesture * > > cachedAlreadyDeliveredGestures
bool childrenCombineOpacity() const
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
bool discardUpdateRequest(bool ignoreVisibleBit=false, bool ignoreDirtyBit=false, bool ignoreOpacity=false) const
Returns true if we can discard an update request; otherwise false.
QPointF lastPos() const
Returns the last recorded mouse cursor position in item coordinates.
virtual void draw(QPainter *painter)=0
This pure virtual function draws the effect and is called whenever the source needs to be drawn...
The QMap class is a template class that provides a skip-list-based dictionary.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
void setLastPos(const QPointF &pos)
Qt::MouseButtons buttons() const
Returns the combination of mouse buttons that were pressed at the time the event was sent...
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
void setScenePos(const QPointF &pos)
Sets the position associated with the hover event to the given point in scene coordinates.
QRectF itemsBoundingRect() const
Calculates and returns the bounding rect of all items on the scene.
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
This event handler, for event wheelEvent, can be reimplemented in a subclass to receive mouse wheel e...
QPointF pos() const
Returns the mouse position of the event relative to the view that sent the event. ...
The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene.
QList< QGraphicsWidget * > popupWidgets
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
int signalIndex(const char *signalName) const
Returns the signal index used in the internal connectionLists vector.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
Qt::MouseButtons acceptedMouseButtons() const
Returns the mouse buttons that this item accepts mouse events for.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
void setFocus(Qt::FocusReason focusReason=Qt::OtherFocusReason)
Gives keyboard input focus to this item.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
void setItemIndexMethod(ItemIndexMethod method)
quint32 lastMouseGrabberItemHasImplicitMouseGrab
The QPalette class contains color groups for each widget state.
void removeAt(int i)
Removes the item at index position i.
bool sendTouchBeginEvent(QGraphicsItem *item, QTouchEvent *touchEvent)