vymview.cpp
changeset 769 a6931cd6309a
parent 767 6d2b32f305f9
child 772 e3f722759c7e
     1.1 --- a/vymview.cpp	Thu May 14 12:42:58 2009 +0000
     1.2 +++ b/vymview.cpp	Fri May 15 15:22:15 2009 +0000
     1.3 @@ -6,6 +6,7 @@
     1.4  #include "linkablemapobj.h"
     1.5  #include "mainwindow.h"
     1.6  #include "mapeditor.h"
     1.7 +#include "treeeditor.h"
     1.8  
     1.9  extern Main *mainWindow;
    1.10  
    1.11 @@ -15,13 +16,13 @@
    1.12  	model=m;
    1.13  
    1.14  	// Create TreeView
    1.15 -	treeview=new QTreeView;
    1.16 -	treeview->setModel ((QAbstractItemModel*)model);
    1.17 -	//treeview->setMinimumWidth (50);
    1.18 +	treeEditor=new TreeEditor (model);
    1.19 +	treeEditor->setModel ((QAbstractItemModel*)model);
    1.20 +	//treeEditor->setMinimumWidth (50);
    1.21  
    1.22 -	treeview->setColumnWidth (0,350);
    1.23 +	treeEditor->setColumnWidth (0,350);
    1.24  
    1.25 -	selModel=treeview->selectionModel();
    1.26 +	selModel=treeEditor->selectionModel();
    1.27  	model->setSelectionModel (selModel);
    1.28  	connect (
    1.29  		selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
    1.30 @@ -62,11 +63,10 @@
    1.31  		this, SLOT (showSelection() ) );
    1.32  		
    1.33  
    1.34 -	//mapEditor->viewport()->setFocus();	//FIXmapEditor-3 needed?
    1.35  	mapEditor->setAntiAlias (mainWindow->isAliased());
    1.36  	mapEditor->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
    1.37  
    1.38 -	addWidget (treeview);
    1.39 +	addWidget (treeEditor);
    1.40  	addWidget (mapEditor);
    1.41  
    1.42  	// Set geometry
    1.43 @@ -76,12 +76,17 @@
    1.44  	setSizes(widths);
    1.45  }
    1.46  
    1.47 +void VymView::initFocus()
    1.48 +{
    1.49 +	mapEditor->setFocus();
    1.50 +}
    1.51 +
    1.52  QItemSelectionModel* VymView::selectionModel() 
    1.53  {
    1.54 -	if (treeview) 
    1.55 +	if (treeEditor) 
    1.56  		return selModel;
    1.57  	else 
    1.58 -		std::cout <<"VymView::selectionModel: hey, no treeview so far???\n";
    1.59 +		std::cout <<"VymView::selectionModel: hey, no treeEditor so far???\n";
    1.60  	return NULL;
    1.61  }
    1.62  
    1.63 @@ -104,12 +109,12 @@
    1.64  
    1.65  void VymView::expandAll()
    1.66  {
    1.67 -	treeview->expandAll();
    1.68 +	treeEditor->expandAll();
    1.69  }
    1.70  
    1.71  void VymView::showSelection()
    1.72  {
    1.73 -	treeview->scrollTo(
    1.74 +	treeEditor->scrollTo(
    1.75  		model->getSelectedIndex(), 
    1.76  		//QAbstractItemView::PositionAtCenter   
    1.77  		QAbstractItemView::EnsureVisible