# HG changeset patch # User insilmaril # Date 1228914635 0 # Node ID c8b1a3564c74cc379a3746ae2249578d3bbb41b5 # Parent 0594d7b7099d35c0574cd489e65bcba681ff3b3c selection is now visible again and even animated diff -r 0594d7b7099d -r c8b1a3564c74 mapeditor.cpp --- a/mapeditor.cpp Tue Dec 09 16:44:54 2008 +0000 +++ b/mapeditor.cpp Wed Dec 10 13:10:35 2008 +0000 @@ -736,7 +736,9 @@ lmosel->reposition(); } // depth>0 - model->updateSelection();// FIXME needed? + //model->updateSelection();// FIXME needed? + //updateSelectionGeometry(); + updateSelection(selModel->selection(), selModel->selection() ); } // no FloatImageObj scene()->update(); @@ -1066,31 +1068,7 @@ { cout << "ME::updateSelection\n"; - QGraphicsRectItem *sb; -/* - // Check if selection is empty - if (newsel.indexes().isEmpty() ) - { - if (!selboxList.isEmpty()) - while (!selboxList.isEmpty() ) - delete selboxList.takeFirst(); - return; - } - - if (selboxList.isEmpty()) - { - - sb = mapScene->addRect( - QRectF(0,0,0,0), - QPen(selectionColor), - selectionColor); - sb->setZValue(Z_SELBOX); - sb->show(); - selboxList.append (sb); - } else - sb=selboxList.first(); -*/ if (newsel.isEmpty() ) { cout << " newsel=empty!\n"; @@ -1104,18 +1082,40 @@ cout << " h="<<((BranchObj*)lmo)->getHeading().toStdString()<row()<<","<column()<<") = "< selboxList.count() ) { - QRectF bbox=lmo->getBBox(); - selboxList.first()->setRect ( - bbox.x()-w,bbox.y()-w, - bbox.width()+2*w, bbox.height()+2*w); - selboxList.first()->setPen (selectionColor); - selboxList.first()->setBrush (selectionColor); + sb = mapScene->addRect( + QRectF(0,0,0,0), + QPen(selectionColor), + selectionColor); + sb->setZValue(Z_SELBOX); + sb->show(); + selboxList.append (sb); } -*/ + + // Reposition rectangles + int i=0; + QRectF bbox; + foreach (sb,selboxList) + { + index=newsel.indexes().at(i); + ti= static_cast(index.internalPointer()); + lmo=ti->getLMO(); + bbox=lmo->getBBox(); + sb->setRect ( + bbox.x(),bbox.y(), + bbox.width(), bbox.height()); + sb->setPen (selectionColor); + sb->setBrush (selectionColor); + i++; + } } void MapEditor::updateCurrent (const QModelIndex &newsel,const QModelIndex &) @@ -1137,7 +1137,8 @@ cout << "ME::updateSelectionGeometry\n"; // Tell selection to update geometries - model->updateSelection(); + updateSelection(selModel->selection(), selModel->selection() ); + //model->updateSelection(); } diff -r 0594d7b7099d -r c8b1a3564c74 vymmodel.cpp --- a/vymmodel.cpp Tue Dec 09 16:44:54 2008 +0000 +++ b/vymmodel.cpp Wed Dec 10 13:10:35 2008 +0000 @@ -4145,6 +4145,7 @@ bo->reposition(); i++; } + cout << "VM::animate\n"; emit (selectionChanged(selModel->selection(), selModel->selection()) ); mapScene->update(); if (!animObjList.isEmpty()) animationTimer->start(); diff -r 0594d7b7099d -r c8b1a3564c74 vymview.cpp --- a/vymview.cpp Tue Dec 09 16:44:54 2008 +0000 +++ b/vymview.cpp Wed Dec 10 13:10:35 2008 +0000 @@ -29,11 +29,9 @@ me,SLOT (updateCurrent(const QModelIndex &,const QModelIndex &))); // VymModel may want to update selection, e.g. during animation - /* connect ( model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &))); - */ //me->viewport()->setFocus(); //FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn());