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(); }