1.1 --- a/vymview.cpp Fri May 15 15:22:15 2009 +0000
1.2 +++ b/vymview.cpp Tue May 26 11:24:51 2009 +0000
1.3 @@ -3,7 +3,6 @@
1.4 #include <iostream>
1.5 using namespace std;
1.6
1.7 -#include "linkablemapobj.h"
1.8 #include "mainwindow.h"
1.9 #include "mapeditor.h"
1.10 #include "treeeditor.h"
1.11 @@ -34,13 +33,7 @@
1.12 connect (
1.13 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
1.14 mapEditor,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
1.15 - /*
1.16 - connect (
1.17 - selModel, SIGNAL (currentChanged(const QModelIndex &, const QModelIndex &)),
1.18 - me,SLOT (updateCurrent(const QModelIndex &,const QModelIndex &)));
1.19 - */
1.20 - /*
1.21 -*/
1.22 +
1.23 connect (
1.24 model, SIGNAL (dataChanged(const QModelIndex &, const QModelIndex &)),
1.25 mapEditor,SLOT (updateData(const QModelIndex &) ) );
1.26 @@ -76,6 +69,21 @@
1.27 setSizes(widths);
1.28 }
1.29
1.30 +VymView::~VymView()
1.31 +{
1.32 + //cout << "Destructor VymView\n";
1.33 +}
1.34 +
1.35 +VymModel* VymView::getModel()
1.36 +{
1.37 + return model;
1.38 +}
1.39 +
1.40 +MapEditor* VymView::getMapEditor()
1.41 +{
1.42 + return mapEditor;
1.43 +}
1.44 +
1.45 void VymView::initFocus()
1.46 {
1.47 mapEditor->setFocus();
1.48 @@ -92,16 +100,6 @@
1.49
1.50 void VymView::changeSelection (const QItemSelection &newsel, const QItemSelection &oldsel)
1.51 {
1.52 - /*
1.53 - cout <<"VymView::changeSelection (";
1.54 - if (!newsel.indexes().isEmpty() )
1.55 - cout << model->getItem(newsel.indexes().first() )->getHeading().toStdString();
1.56 - cout << " <- ";
1.57 - if (!oldsel.indexes().isEmpty() )
1.58 - cout << model->getItem(oldsel.indexes().first() )->getHeading().toStdString();
1.59 - cout << ")\n";
1.60 - */
1.61 -
1.62 // Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...)
1.63 mainWindow->changeSelection (model,newsel,oldsel); // FIXME-3 maybe connect VymModel <-> MainWindow directly?
1.64 showSelection();
1.65 @@ -114,14 +112,8 @@
1.66
1.67 void VymView::showSelection()
1.68 {
1.69 - treeEditor->scrollTo(
1.70 - model->getSelectedIndex(),
1.71 - //QAbstractItemView::PositionAtCenter
1.72 - QAbstractItemView::EnsureVisible
1.73 - );
1.74 -
1.75 - LinkableMapObj* lmo=model->getSelectedLMO();
1.76 - if (lmo)
1.77 - mapEditor->setScrollBarPosTarget (lmo->getBBox() );
1.78 + QModelIndex ix=model->getSelectedIndex();
1.79 + treeEditor->scrollTo( ix, QAbstractItemView::EnsureVisible);
1.80 + mapEditor->scrollTo ( ix);
1.81 }
1.82