summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview/qgraphicsscene.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index f6e0aaf..0655ecc 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -925,19 +925,19 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre
Q_Q(const QGraphicsScene);
QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0;
if (!view)
- return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, QTransform());
+ return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());
const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1));
if (!view->isTransformed())
- return q->items(pointRect, Qt::IntersectsItemShape, Qt::AscendingOrder);
+ return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder);
const QTransform viewTransform = view->viewportTransform();
if (viewTransform.type() <= QTransform::TxScale) {
return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape,
- Qt::AscendingOrder, viewTransform);
+ Qt::DescendingOrder, viewTransform);
}
return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape,
- Qt::AscendingOrder, viewTransform);
+ Qt::DescendingOrder, viewTransform);
}
/*!
@@ -1584,7 +1584,7 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method)
d->indexMethod = method;
- QList<QGraphicsItem *> oldItems = d->index->items(Qt::AscendingOrder);
+ QList<QGraphicsItem *> oldItems = d->index->items(Qt::DescendingOrder);
delete d->index;
if (method == BspTreeIndex)
d->index = new QGraphicsSceneBspTreeIndex(this);
@@ -1693,7 +1693,7 @@ QRectF QGraphicsScene::itemsBoundingRect() const
QList<QGraphicsItem *> QGraphicsScene::items() const
{
Q_D(const QGraphicsScene);
- return d->index->items(Qt::AscendingOrder);
+ return d->index->items(Qt::DescendingOrder);
}
/*!
@@ -1724,7 +1724,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const
QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
{
Q_D(const QGraphicsScene);
- return d->index->items(pos, Qt::IntersectsItemShape, Qt::AscendingOrder);
+ return d->index->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder);
}
/*!
@@ -1746,7 +1746,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->index->items(rectangle, mode, Qt::AscendingOrder);
+ return d->index->items(rectangle, mode, Qt::DescendingOrder);
}
/*!
@@ -1794,7 +1794,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSe
QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->index->items(polygon, mode, Qt::AscendingOrder);
+ return d->index->items(polygon, mode, Qt::DescendingOrder);
}
/*!
@@ -1816,7 +1816,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->index->items(path, mode, Qt::AscendingOrder);
+ return d->index->items(path, mode, Qt::DescendingOrder);
}
/*!
@@ -1928,7 +1928,7 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
// Does not support ItemIgnoresTransformations.
QList<QGraphicsItem *> tmp;
- foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder)) {
+ foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder)) {
if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode))
tmp << itemInVicinity;
}
@@ -1972,7 +1972,7 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const
{
QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
- Qt::AscendingOrder, deviceTransform);
+ Qt::DescendingOrder, deviceTransform);
return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
}
@@ -2127,7 +2127,7 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectio
bool changed = false;
// Set all items in path to selected.
- foreach (QGraphicsItem *item, items(path, mode, Qt::AscendingOrder, deviceTransform)) {
+ foreach (QGraphicsItem *item, items(path, mode, Qt::DescendingOrder, deviceTransform)) {
if (item->flags() & QGraphicsItem::ItemIsSelectable) {
if (!item->isSelected())
changed = true;
@@ -2434,17 +2434,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Ensure that newly added items that have subfocus set, gain
// focus automatically if there isn't a focus item already.
- if (!d->focusItem) {
- if (item->focusItem() == item && item != d->lastFocusItem) {
- QGraphicsItem *fi = item->focusItem() ? item->focusItem() : item->focusScopeItem();
- if (fi) {
- QGraphicsItem *fsi;
- while ((fsi = fi->focusScopeItem()) && fsi->isVisible())
- fi = fsi;
- fi->setFocus();
- }
- }
- }
+ if (!d->focusItem && item != d->lastFocusItem && item->focusItem() == item)
+ item->focusItem()->setFocus();
d->updateInputMethodSensitivityInViews();
}
@@ -4380,7 +4371,7 @@ void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const
if (viewTransform)
exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect);
}
- const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::DescendingOrder);
+ const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::AscendingOrder);
for (int i = 0; i < tli.size(); ++i)
drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget);
}