🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
UiObjectTreeItem.hpp
浏览该文件的文档.
1
19
20#pragma once
21
22#include "AstGlobal.h"
23#include "AstUtil/Object.hpp"
24#include <QTreeWidget>
25#include <vector>
26
27AST_NAMESPACE_BEGIN
28
31{
32 bool showComponents = true;
33};
34
35class AST_GUI_API UiObjectTreeItem : public QTreeWidgetItem
36{
37public:
39
40 explicit UiObjectTreeItem(Object* obj);
41
43 void buildChildren(const TreeBuildOptions& options = {});
44
46 Object* object() const { return object_.get(); }
47
48 template<typename T>
49 T getObject() const { return aobject_cast<T>(object()); }
50
51 UiObjectTreeItem* clone() const override;
52
54 virtual QList<UiObjectTreeItem*> createChildItems(const TreeBuildOptions& options = {}) const;
55private:
57 void configure(Object* obj);
58private:
59 WeakPtr<Object> object_ = nullptr;
60};
61
62AST_NAMESPACE_END
对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能
定义 Object.hpp:95
定义 UiObjectTreeItem.hpp:36
Object * object() const
获取关联的对象
定义 UiObjectTreeItem.hpp:46
对象树构建选项
定义 UiObjectTreeItem.hpp:31