vymview.cpp
changeset 728 a8a98a94899a
parent 727 96402b172173
child 729 7ddbe3fa34a1
     1.1 --- a/vymview.cpp	Wed Oct 29 17:42:34 2008 +0000
     1.2 +++ b/vymview.cpp	Tue Nov 04 12:09:10 2008 +0000
     1.3 @@ -12,18 +12,24 @@
     1.4  	treeview->setMinimumWidth (350);
     1.5  	treeview->setColumnWidth (0,350);
     1.6  
     1.7 -	// ItemSelectionModel
     1.8  	selModel=treeview->selectionModel();
     1.9 +	model->setSelectionModel (selModel);
    1.10  	connect (
    1.11  		selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
    1.12  		this,SLOT (changeSelection(const QItemSelection &,const QItemSelection &)));
    1.13 -	model->setSelectionModel (selModel);
    1.14  
    1.15  	// Create good old MapEditor
    1.16  	MapEditor* me=model->getMapEditor();
    1.17  	if (!me) me=new MapEditor (model);
    1.18 +	connect (
    1.19 +		selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
    1.20 +		me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
    1.21  
    1.22 -	me->setSelectionModel (selModel);
    1.23 +	// VymModel may want to update selection, e.g. during animation
    1.24 +	connect (
    1.25 +		model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
    1.26 +		me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
    1.27 +
    1.28  
    1.29  	//me->viewport()->setFocus();
    1.30  	//FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn());
    1.31 @@ -41,8 +47,10 @@
    1.32  
    1.33  QItemSelectionModel* VymView::selectionModel() 
    1.34  {
    1.35 -	if (treeview) return selModel;
    1.36 -	else std::cout <<"hey, no treeview so far???\n";
    1.37 +	if (treeview) 
    1.38 +		return selModel;
    1.39 +	else 
    1.40 +		std::cout <<"VymView::selectionModel: hey, no treeview so far???\n";
    1.41  	return NULL;
    1.42  }
    1.43