mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 13:00:05 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #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);
 | |
|    explicit TreeItem(std::initializer_list<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);
 | |
|    TreeItem* FindChild(int column, const QVariant& data);
 | |
| 
 | |
|    const TreeItem*        child(int row) const;
 | |
|    TreeItem*              child(int row);
 | |
|    std::vector<TreeItem*> children();
 | |
|    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
 | 
