mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 14:56:38 +00:00 
			
		
		
		
	Fix folder name. Keep Qt optional. Move open dialogue from doc to tools. Rename 'load' to 'open'. Deleted wrong comment.
		
			
				
	
	
		
			57 lines
		
	
	
	
		
			892 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			892 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "modelitem.hpp"
 | |
| 
 | |
| ModelItem::ModelItem(ModelItem *parent)
 | |
|     : mParentItem(parent)
 | |
|     , QObject(parent)
 | |
| {
 | |
| }
 | |
| 
 | |
| ModelItem::~ModelItem()
 | |
| {
 | |
|     qDeleteAll(mChildItems);
 | |
| }
 | |
| 
 | |
| 
 | |
| ModelItem *ModelItem::parent()
 | |
| {
 | |
|     return mParentItem;
 | |
| }
 | |
| 
 | |
| int ModelItem::row() const
 | |
| {
 | |
|     if (mParentItem)
 | |
|         return 1;
 | |
|         //return mParentItem->childRow(const_cast<ModelItem*>(this));
 | |
|         //return mParentItem->mChildItems.indexOf(const_cast<ModelItem*>(this));
 | |
| 
 | |
|     return -1;
 | |
| }
 | |
| 
 | |
| 
 | |
| int ModelItem::childCount() const
 | |
| {
 | |
|     return mChildItems.count();
 | |
| }
 | |
| 
 | |
| int ModelItem::childRow(ModelItem *child) const
 | |
| {
 | |
|     Q_ASSERT(child);
 | |
| 
 | |
|     return mChildItems.indexOf(child);
 | |
| }
 | |
| 
 | |
| ModelItem *ModelItem::child(int row)
 | |
| {
 | |
|     return mChildItems.value(row);
 | |
| }
 | |
| 
 | |
| 
 | |
| void ModelItem::appendChild(ModelItem *item)
 | |
| {
 | |
|     mChildItems.append(item);
 | |
| }
 | |
| 
 | |
| void ModelItem::removeChild(int row)
 | |
| {
 | |
|     mChildItems.removeAt(row);
 | |
| }
 |