diff -r 01f2f6d6789d -r e3f722759c7e vymview.cpp --- a/vymview.cpp Mon May 18 11:22:41 2009 +0000 +++ b/vymview.cpp Wed May 20 15:40:14 2009 +0000 @@ -3,7 +3,6 @@ #include using namespace std; -#include "linkablemapobj.h" #include "mainwindow.h" #include "mapeditor.h" #include "treeeditor.h" @@ -34,13 +33,7 @@ connect ( selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), mapEditor,SLOT (updateSelection(const QItemSelection &,const QItemSelection &))); - /* - connect ( - selModel, SIGNAL (currentChanged(const QModelIndex &, const QModelIndex &)), - me,SLOT (updateCurrent(const QModelIndex &,const QModelIndex &))); - */ - /* -*/ + connect ( model, SIGNAL (dataChanged(const QModelIndex &, const QModelIndex &)), mapEditor,SLOT (updateData(const QModelIndex &) ) ); @@ -76,6 +69,21 @@ setSizes(widths); } +VymView::~VymView() +{ + //cout << "Destructor VymView\n"; +} + +VymModel* VymView::getModel() +{ + return model; +} + +MapEditor* VymView::getMapEditor() +{ + return mapEditor; +} + void VymView::initFocus() { mapEditor->setFocus(); @@ -92,16 +100,6 @@ void VymView::changeSelection (const QItemSelection &newsel, const QItemSelection &oldsel) { - /* - cout <<"VymView::changeSelection ("; - if (!newsel.indexes().isEmpty() ) - cout << model->getItem(newsel.indexes().first() )->getHeading().toStdString(); - cout << " <- "; - if (!oldsel.indexes().isEmpty() ) - cout << model->getItem(oldsel.indexes().first() )->getHeading().toStdString(); - cout << ")\n"; - */ - // Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...) mainWindow->changeSelection (model,newsel,oldsel); // FIXME-3 maybe connect VymModel <-> MainWindow directly? showSelection(); @@ -114,14 +112,8 @@ void VymView::showSelection() { - treeEditor->scrollTo( - model->getSelectedIndex(), - //QAbstractItemView::PositionAtCenter - QAbstractItemView::EnsureVisible - ); - - LinkableMapObj* lmo=model->getSelectedLMO(); - if (lmo) - mapEditor->setScrollBarPosTarget (lmo->getBBox() ); + QModelIndex ix=model->getSelectedIndex(); + treeEditor->scrollTo( ix, QAbstractItemView::EnsureVisible); + mapEditor->scrollTo ( ix); }