vymview.cpp
changeset 763 8c028a5d9083
parent 761 0301e6109702
child 767 6d2b32f305f9
     1.1 --- a/vymview.cpp	Thu Apr 30 11:52:49 2009 +0000
     1.2 +++ b/vymview.cpp	Fri May 01 10:30:29 2009 +0000
     1.3 @@ -3,6 +3,7 @@
     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  
    1.11 @@ -58,6 +59,14 @@
    1.12  		model, SIGNAL (noteHasChanged(QModelIndex) ),
    1.13  		mainWindow, SLOT (updateNoteEditor (QModelIndex) ) );
    1.14  		
    1.15 +	connect (
    1.16 +		model, SIGNAL (expandAll() ),
    1.17 +		this, SLOT (expandAll () ) );
    1.18 +		
    1.19 +	connect (
    1.20 +		model, SIGNAL (showSelection() ),
    1.21 +		this, SLOT (showSelection() ) );
    1.22 +		
    1.23  
    1.24  	//mapEditor->viewport()->setFocus();	//FIXmapEditor-3 needed?
    1.25  	mapEditor->setAntiAlias (mainWindow->isAliased());
    1.26 @@ -105,3 +114,21 @@
    1.27  	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-3 maybe connect VymModel <-> MainWindow directly?
    1.28  }
    1.29  
    1.30 +void VymView::expandAll()
    1.31 +{
    1.32 +	treeview->expandAll();
    1.33 +}
    1.34 +
    1.35 +void VymView::showSelection()
    1.36 +{
    1.37 +	treeview->scrollTo(
    1.38 +		model->getSelectedIndex(), 
    1.39 +		//QAbstractItemView::PositionAtCenter   
    1.40 +		QAbstractItemView::EnsureVisible
    1.41 +	);
    1.42 +
    1.43 +	LinkableMapObj* lmo=model->getSelectedLMO();
    1.44 +	if (lmo)
    1.45 +		mapEditor->ensureVisible(lmo->getBBox() );
    1.46 +}
    1.47 +