1.1 --- a/mapeditor.cpp Wed Dec 10 13:10:35 2008 +0000
1.2 +++ b/mapeditor.cpp Mon Jan 05 16:31:38 2009 +0000
1.3 @@ -90,7 +90,6 @@
1.4 connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
1.5
1.6 // Selections
1.7 - selModel=vm->getSelectionModel();
1.8 selectionColor =QColor (255,255,0);
1.9
1.10
1.11 @@ -550,11 +549,11 @@
1.12 cout << " ti ("<<ti->row()<<","<<ti->column()<<") = "<<ti<<endl;
1.13 //QModelIndex ix=model->index( ti->row(), ti->column(), model->index (0,0,QModelIndex()) );
1.14 QModelIndex ix=model->index(ti);
1.15 - selModel->select (ix,QItemSelectionModel::ClearAndSelect );
1.16 + model->getSelectionModel()->select (ix,QItemSelectionModel::ClearAndSelect );
1.17 /*
1.18 - if (selModel->hasSelection() )
1.19 + if (model->getSelectionModel()->hasSelection() )
1.20 {
1.21 - QModelIndex ixsel=selModel->selectedIndexes().first();
1.22 + QModelIndex ixsel=model->getSelectionModel()->selectedIndexes().first();
1.23 TreeItem *tisel= static_cast<TreeItem*>(ixsel.internalPointer());
1.24 ;
1.25 cout << " ti="<<ti<<" tisel="<<tisel<<endl;
1.26 @@ -736,9 +735,9 @@
1.27 lmosel->reposition();
1.28 } // depth>0
1.29
1.30 - //model->updateSelection();// FIXME needed?
1.31 - //updateSelectionGeometry();
1.32 - updateSelection(selModel->selection(), selModel->selection() );
1.33 + QItemSelection sel=model->getSelectionModel()->selection();
1.34 + updateSelection(sel,sel);
1.35 +
1.36 } // no FloatImageObj
1.37
1.38 scene()->update();
1.39 @@ -1066,23 +1065,6 @@
1.40
1.41 void MapEditor::updateSelection(const QItemSelection &newsel,const QItemSelection &)
1.42 {
1.43 - cout << "ME::updateSelection\n";
1.44 -
1.45 -
1.46 - if (newsel.isEmpty() )
1.47 - {
1.48 - cout << " newsel=empty!\n";
1.49 - return;
1.50 - }
1.51 - QModelIndex index=newsel.indexes().first(); // TODO no multiselections yet
1.52 -
1.53 - TreeItem *ti= static_cast<TreeItem*>(index.internalPointer());
1.54 - LinkableMapObj *lmo=ti->getLMO();
1.55 - cout << " newsel.count="<<newsel.indexes().count()<<" lmo="<<lmo<<endl;
1.56 - cout << " h="<<((BranchObj*)lmo)->getHeading().toStdString()<<endl;
1.57 - cout << " ti ("<<ti->row()<<","<<ti->column()<<") = "<<ti<<endl;
1.58 -
1.59 -
1.60 // Reduce rectangles
1.61 while (newsel.indexes().count() < selboxList.count() )
1.62 delete selboxList.takeFirst();
1.63 @@ -1103,6 +1085,10 @@
1.64 // Reposition rectangles
1.65 int i=0;
1.66 QRectF bbox;
1.67 + QModelIndex index;
1.68 +
1.69 + TreeItem *ti;
1.70 + LinkableMapObj *lmo;
1.71 foreach (sb,selboxList)
1.72 {
1.73 index=newsel.indexes().at(i);
1.74 @@ -1120,10 +1106,11 @@
1.75
1.76 void MapEditor::updateCurrent (const QModelIndex &newsel,const QModelIndex &)
1.77 {
1.78 +
1.79 +/* FIXME testing
1.80 +
1.81 cout << "ME::updateCurrent\n";
1.82
1.83 -/*
1.84 -
1.85 TreeItem *item = static_cast<TreeItem*>(newsel.internalPointer());
1.86 LinkableMapObj *lmo=item->getLMO();
1.87 cout << " lmo="<<lmo<<endl;
1.88 @@ -1132,20 +1119,11 @@
1.89
1.90 }
1.91
1.92 -void MapEditor::updateSelectionGeometry() // FIXME VM only called from VM::animate...
1.93 -{
1.94 - cout << "ME::updateSelectionGeometry\n";
1.95 -
1.96 - // Tell selection to update geometries
1.97 - updateSelection(selModel->selection(), selModel->selection() );
1.98 - //model->updateSelection();
1.99 -}
1.100 -
1.101 -
1.102 void MapEditor::setSelectionColor (QColor col)
1.103 {
1.104 selectionColor=col;
1.105 - updateSelectionGeometry();
1.106 + QItemSelection sel=model->getSelectionModel()->selection();
1.107 + updateSelection(sel,sel);
1.108 }
1.109
1.110 QColor MapEditor::getSelectionColor ()