diff -r 25ee6b988b73 -r 8f987e376035 mapeditor.cpp --- a/mapeditor.cpp Tue Dec 15 09:14:59 2009 +0000 +++ b/mapeditor.cpp Mon Jan 04 20:36:06 2010 +0000 @@ -113,10 +113,7 @@ // Action to embed LineEdit for heading in Scene editingHeading=false; - lineEdit=new QLineEdit; - lineEdit->hide(); - QGraphicsProxyWidget *pw=scene()->addWidget (lineEdit); - pw->setZValue (Z_LINEEDIT); + lineEdit=NULL; a = new QAction( tr( "Edit heading","MapEditor" ), this); a->setShortcut ( Qt::Key_Return ); //Edit heading @@ -405,35 +402,55 @@ QRectF MapEditor::getTotalBBox() { - QRectF r; + QPen pen; + pen.setWidth (1); + pen.setCapStyle ( Qt::RoundCap ); + + QRectF rt; BranchObj *bo; - for (int i=0;igetRootItem()->branchCount(); i++) + BranchItem *cur=NULL; + BranchItem *prev=NULL; + model->nextBranch(cur,prev); + while (cur) { - bo=(BranchObj*)(model->getRootItem()->getBranchNum(i)->getLMO()); - if (bo) r=addBBox (bo->getTotalBBox(), r); + if (!cur->hasHiddenExportParent()) + { + bo=(BranchObj*)(cur->getLMO()); + if (bo && bo->isVisibleObj()) + { + bo->calcBBoxSizeWithChildren(); + // FIXME-3 testing + //QRectF r1=bo->getBBoxSizeWithChildren(); + QRectF r1=bo->getBBox(); + //pen.setColor ( QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8)); + //mapScene->addRect (r1,pen); + + if (rt.isNull()) rt=r1; + rt=addBBox (r1, rt); + //FIXME-2 cout <<"ME: r1="<getHeadingStd()<setBrush (QColor(white)); + frame->setPen (QColor(black)); + frame->setZValue(0); + frame->show(); + + } + else + { + setHideTmpMode (HideNone); + } + cout <<" hidemode="<setBrush (QColor(white)); - frame->setPen (QColor(black)); - frame->setZValue(0); - frame->show(); - } - else - { - setHideTmpMode (HideNone); - } - cout <<" hidemode="<setExportMode (false); + return; + // Create list with all bounding polygons QList mapobjects; QList polys; @@ -899,6 +919,10 @@ { model->setSelectionBlocked(true); + lineEdit=new QLineEdit; + QGraphicsProxyWidget *pw=scene()->addWidget (lineEdit); + pw->setZValue (Z_LINEEDIT); + lineEdit->setText (bi->getHeading()); QPoint p = mapTo (this,bo->getAbsPos().toPoint() ); lineEdit->setGeometry(p.x(),p.y(),230,25); @@ -915,9 +939,10 @@ { editingHeading=false; lineEdit->releaseKeyboard(); + lineEdit->clearFocus(); model->setHeading (lineEdit->text() ); model->setSelectionBlocked(false); - lineEdit->hide(); + delete (lineEdit); // Maybe reselect previous branch mainWindow->editHeadingFinished (model); @@ -1281,7 +1306,7 @@ } // depth>0 // Maybe we can relink temporary? - if (dsti) // FIXME-1 check if dsti is ancestor of myself! + if (dsti) { if (e->modifiers()==Qt::ControlModifier) {