minor fixes
authorinsilmaril
Tue, 28 Apr 2009 20:53:44 +0000
changeset 759bf3ea1f1520b
parent 758 04039e47ac74
child 760 59614eaf5fbb
minor fixes
treeitem.h
vymmodel.cpp
vymview.cpp
     1.1 --- a/treeitem.h	Tue Apr 28 09:51:48 2009 +0000
     1.2 +++ b/treeitem.h	Tue Apr 28 20:53:44 2009 +0000
     1.3 @@ -25,28 +25,28 @@
     1.4      ~TreeItem();
     1.5  	void init();
     1.6  
     1.7 -	QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
     1.8 +	virtual QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
     1.9  
    1.10  
    1.11  	// General housekeeping
    1.12 -	void setModel (VymModel *m);
    1.13 -	VymModel* getModel();
    1.14 +	virtual void setModel (VymModel *m);
    1.15 +	virtual VymModel* getModel();
    1.16  
    1.17 -    void appendChild (TreeItem *child);
    1.18 -	void removeChild (int row);
    1.19 +    virtual void appendChild (TreeItem *child);
    1.20 +	virtual void removeChild (int row);
    1.21  
    1.22 -    TreeItem *child(int row);
    1.23 -    int childCount() const;
    1.24 -    int childNumber() const;
    1.25 -    int columnCount() const;
    1.26 -	int branchCount() const;
    1.27 -	int imageCount() const;
    1.28 -	int xlinkCount() const;
    1.29 +    virtual TreeItem *child(int row);
    1.30 +    virtual int childCount() const;
    1.31 +    virtual int childNumber() const;
    1.32 +    virtual int columnCount() const;
    1.33 +	virtual int branchCount() const;
    1.34 +	virtual int imageCount() const;
    1.35 +	virtual int xlinkCount() const;
    1.36  
    1.37 -    int row() const;
    1.38 -	int column() const;
    1.39 -	int depth() ;
    1.40 -    TreeItem *parent();
    1.41 +    virtual int row() const;
    1.42 +	virtual int column() const;
    1.43 +	virtual int depth() ;
    1.44 +    virtual TreeItem *parent();
    1.45  
    1.46  	/*! Return number of item in parent by type, 
    1.47  	    e.g. first branch has number 0           */
     2.1 --- a/vymmodel.cpp	Tue Apr 28 09:51:48 2009 +0000
     2.2 +++ b/vymmodel.cpp	Tue Apr 28 20:53:44 2009 +0000
     2.3 @@ -241,25 +241,25 @@
     2.4  	FloatImageObj (mapScene).resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe...
     2.5  
     2.6  	// Build xml recursivly
     2.7 -	if (!saveSel || typeid (*saveSel) == typeid (MapCenterObj))
     2.8 +	if (!saveSel || saveSel->getType()==TreeItem::MapCenter)
     2.9  		// Save all mapcenters as complete map, if saveSel not set
    2.10  		s+=saveTreeToDir(tmpdir,prefix,writeflags,offset);
    2.11  	else
    2.12  	{
    2.13 -		if ( typeid(*saveSel) == typeid(BranchObj) )
    2.14 +		if (saveSel->getType()==TreeItem::Branch)
    2.15  			// Save Subtree
    2.16 -			s+=((BranchObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
    2.17 -		else if ( typeid(*saveSel) == typeid(FloatImageObj) )
    2.18 +			s+=saveSel->saveToDir(tmpdir,prefix,offset);
    2.19 +		//FIXME-2 else if (saveSel->getType()==TreeItem::Image)
    2.20  			// Save image
    2.21 -			s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
    2.22 +			//s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
    2.23  	}
    2.24  
    2.25  	// Save local settings
    2.26  	s+=settings.getDataXML (destPath);
    2.27  
    2.28  	// Save selection
    2.29 -	if (!selection.isEmpty() && !saveSel ) 
    2.30 -		s+=xml.valueElement("select",selection.getSelectString());
    2.31 +	if (getSelectedItem() && !saveSel ) 
    2.32 +		s+=xml.valueElement("select",getSelectString());
    2.33  
    2.34  	xml.decIndent();
    2.35  	s+=xml.endElement("vymmap");
     3.1 --- a/vymview.cpp	Tue Apr 28 09:51:48 2009 +0000
     3.2 +++ b/vymview.cpp	Tue Apr 28 20:53:44 2009 +0000
     3.3 @@ -16,7 +16,11 @@
     3.4  	// Create TreeView
     3.5  	treeview=new QTreeView;
     3.6  	treeview->setModel ((QAbstractItemModel*)model);
     3.7 -	treeview->setMinimumWidth (350);
     3.8 +	//treeview->setMinimumWidth (50);
     3.9 +	QList <int> widths;
    3.10 +	widths<<30;
    3.11 +	widths<<150;
    3.12 +	setSizes(widths);
    3.13  	treeview->setColumnWidth (0,350);
    3.14  
    3.15  	selModel=treeview->selectionModel();