Fixed the 'hard to grab' Handler, Dive Planner now is very smooth.

So, it was on the docs, but I didn't read it before, if the
scene has items that ignores transformations, we need to
pass the view transform to the method that gets the items
in the scene. I also used IntersectsItemBoundingRect instead
of IntersectsItemsShape because it's faster, and our items
are small, so we don't need an very accurate but slower method.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-07-04 10:34:30 -03:00
parent 20ec98f2a5
commit ae08a81739

View file

@ -364,7 +364,7 @@ bool DivePlannerGraphics::isPointOutOfBoundaries(const QPointF& point)
void DivePlannerGraphics::mousePressEvent(QMouseEvent* event)
{
QPointF mappedPos = mapToScene(event->pos());
Q_FOREACH(QGraphicsItem *item, scene()->items(mappedPos)) {
Q_FOREACH(QGraphicsItem *item, scene()->items(mappedPos, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, transform())){
if (DiveHandler *h = qgraphicsitem_cast<DiveHandler*>(item)) {
activeDraggedHandler = h;
activeDraggedHandler->setBrush(Qt::red);