vymmodel.cpp
changeset 769 a6931cd6309a
parent 767 6d2b32f305f9
child 771 01f2f6d6789d
     1.1 --- a/vymmodel.cpp	Thu May 14 12:42:58 2009 +0000
     1.2 +++ b/vymmodel.cpp	Fri May 15 15:22:15 2009 +0000
     1.3 @@ -238,7 +238,6 @@
     1.4  	// TODO constr. of FIO creates lots of objects, better do this in some other way...
     1.5  	FloatImageObj (mapScene).resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe...
     1.6  
     1.7 -	cout << "VM::saveToDir 0 " <<saveSel<<endl;
     1.8  	// Build xml recursivly
     1.9  	if (!saveSel || saveSel->getType()==TreeItem::MapCenter)
    1.10  		// Save all mapcenters as complete map, if saveSel not set
    1.11 @@ -2211,7 +2210,6 @@
    1.12  {
    1.13  	if (branch && dst)
    1.14  	{
    1.15 -		cout << "VM::relinkBranch "<<branch->getHeadingStd()<<"  to "<<dst->getHeadingStd()<<"  at "<<pos<<endl;
    1.16  		emit (layoutAboutToBeChanged() );
    1.17  		BranchItem *branchpi=(BranchItem*)branch->parent();
    1.18  		// Remove at current position
    1.19 @@ -4603,11 +4601,16 @@
    1.20  
    1.21  bool VymModel::select (TreeItem *ti)
    1.22  {
    1.23 -	if (ti)
    1.24 +	if (ti) return select (index(ti));
    1.25 +	return false;
    1.26 +}
    1.27 +
    1.28 +bool VymModel::select (const QModelIndex &index)
    1.29 +{
    1.30 +	if (index.isValid() )
    1.31  	{
    1.32 -		QModelIndex ix=index(ti);
    1.33 -		selModel->select (ix,QItemSelectionModel::ClearAndSelect  );
    1.34 -		ti->setLastSelectedBranch();
    1.35 +		selModel->select (index,QItemSelectionModel::ClearAndSelect  );
    1.36 +		getSelectedItem()->setLastSelectedBranch();
    1.37  		return true;
    1.38  	}
    1.39  	return false;