mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:30:04 +00:00 
			
		
		
		
	Refactoring generic tree model behavior
This commit is contained in:
		
							parent
							
								
									1ba60f0da1
								
							
						
					
					
						commit
						98f8bab79a
					
				
					 7 changed files with 348 additions and 236 deletions
				
			
		
							
								
								
									
										44
									
								
								scwx-qt/source/scwx/qt/model/tree_item.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								scwx-qt/source/scwx/qt/model/tree_item.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <memory> | ||||
| #include <vector> | ||||
| 
 | ||||
| #include <QVariant> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace model | ||||
| { | ||||
| 
 | ||||
| class TreeItem | ||||
| { | ||||
| public: | ||||
|    explicit TreeItem(const std::vector<QVariant>& data, | ||||
|                      TreeItem*                    parent = nullptr); | ||||
|    virtual ~TreeItem(); | ||||
| 
 | ||||
|    TreeItem(const TreeItem&)            = delete; | ||||
|    TreeItem& operator=(const TreeItem&) = delete; | ||||
| 
 | ||||
|    TreeItem(TreeItem&&) noexcept; | ||||
|    TreeItem& operator=(TreeItem&&) noexcept; | ||||
| 
 | ||||
|    void AppendChild(TreeItem* child); | ||||
| 
 | ||||
|    const TreeItem* child(int row) const; | ||||
|    int             child_count() const; | ||||
|    int             column_count() const; | ||||
|    QVariant        data(int column) const; | ||||
|    int             row() const; | ||||
|    const TreeItem* parent_item() const; | ||||
| 
 | ||||
| private: | ||||
|    class Impl; | ||||
|    std::unique_ptr<Impl> p; | ||||
| }; | ||||
| 
 | ||||
| } // namespace model
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat