# HG changeset patch # User insilmaril # Date 1232638808 0 # Node ID 53e51e8d47e70294af71cedf677cb0b7fa154bb0 # Parent 21f115d48daf53c473b171aa3b53a0344b2bbd65 More work on removing Selection class diff -r 21f115d48daf -r 53e51e8d47e7 mapeditor.cpp --- a/mapeditor.cpp Thu Jan 22 11:39:53 2009 +0000 +++ b/mapeditor.cpp Thu Jan 22 15:40:08 2009 +0000 @@ -1081,7 +1081,6 @@ index=newsel.indexes().at(i); ti= static_cast(index.internalPointer()); lmo=ti->getLMO(); - cout << " ME::updateSelection of "<<((BranchObj*)lmo)->getHeading().toStdString()<<"\n"; bbox=lmo->getBBox(); sb->setRect ( bbox.x(),bbox.y(), diff -r 21f115d48daf -r 53e51e8d47e7 vymmodel.cpp --- a/vymmodel.cpp Thu Jan 22 11:39:53 2009 +0000 +++ b/vymmodel.cpp Thu Jan 22 15:40:08 2009 +0000 @@ -1523,18 +1523,6 @@ } } -void VymModel::setHeadingInt(const QString &s) -{ - BranchObj *bo=getSelectedBranch(); - if (bo) - { - bo->setHeading(s); - reposition(); - selection.update(); - ensureSelectionVisible(); - } -} - BranchObj* VymModel::findText (QString s, bool cs) { QTextDocument::FindFlags flags=0; @@ -4451,7 +4439,7 @@ TreeItem *ti=lmo->getTreeItem(); QModelIndex ix=index(ti); selModel->select (ix,QItemSelectionModel::ClearAndSelect ); - //updateSelection(oldsel); + //updateSelection(oldsel); //FIXME needed? return true; } return false; @@ -4728,33 +4716,28 @@ QItemSelection oldsel=selModel->selection(); - BranchObj* bo; BranchObj* par; LinkableMapObj *sel=getSelectedBranch(); if (sel) { - if (selectionType()==TreeItem::MapCenter) + if (selectionType()== TreeItem::MapCenter) { - par=getSelectedBranch(); - bo=par->getLastSelectedBranch(); - if (bo) - { - // Workaround for reselecting on left and right side - if (bo->getOrientation()==LinkableMapObj::LeftOfCenter) - bo=par->getFirstBranch(); - if (bo) - { - selection.select(bo); - //selection.update(); - //ensureSelectionVisible(); - //sendSelection(); - } - } + QModelIndex ix=getSelectedIndex(); + selModel->select (index (0,0,ix),QItemSelectionModel::ClearAndSelect ); } else { - par=(BranchObj*)(getSelectedLMO()->getParObj()); - if (getSelectedLMO()->getOrientation()==LinkableMapObj::LeftOfCenter) + par=(BranchObj*)(sel->getParObj()); + if (sel->getOrientation()==LinkableMapObj::RightOfCenter) { + // right of center + if (selectionType() == TreeItem::Branch ) + { + selectLastSelectedBranch(); + return; + } + } else + { + // left of center if (selectionType() == TreeItem::Branch || selectionType() == TreeItem::Image) { @@ -4762,25 +4745,9 @@ ix=parent(ix); selModel->select (ix,QItemSelectionModel::ClearAndSelect ); } - } else - { - if (selectionType() == TreeItem::Branch) - { - bo=getSelectedBranch()->getLastSelectedBranch(); - if (bo) - { - selection.select(bo); - //selection.update(); - //ensureSelectionVisible(); - //sendSelection(); - } - } } - } - QItemSelection newsel=selModel->selection(); - emit (selectionChanged(newsel,oldsel)); - ensureSelectionVisible(); - sendSelection(); + } + updateSelection (oldsel); } } diff -r 21f115d48daf -r 53e51e8d47e7 vymmodel.h --- a/vymmodel.h Thu Jan 22 11:39:53 2009 +0000 +++ b/vymmodel.h Thu Jan 22 15:40:08 2009 +0000 @@ -236,8 +236,6 @@ public: void setHeading(const QString &); //!< Set heading of branch // QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch -private: - void setHeadingInt(const QString &); private: BranchObj* itFind; // next object in find process