🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
UiVariableList.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/VariableList.hpp"
25#include "AstCore/Object.hpp"
26#include "AstScript/Expr.hpp"
27#include <QWidget>
28#include <QTableWidget>
29#include <QVBoxLayout>
30#include <QHBoxLayout>
31#include <QEvent>
32#include <QToolButton>
33
34AST_NAMESPACE_BEGIN
35
37class AST_GUI_API UiVariableList : public QWidget
38{
39 Q_OBJECT
40public:
41 explicit UiVariableList(QWidget* parent = nullptr);
42
46 void setVariableList(VariableList* variableList, Object* owner);
47
51 void setInterpreter(Interpreter* interpreter, Object* owner);
52
54 void setToolbarVisible(bool visible);
55
57 void refreshUi();
58
60 Variable* selectedVariable() const;
61
63 VariableList* variableList() const;
64
66 Interpreter* interpreter() const;
67
70 void addExpression(Expr* expr, bool bind);
71
74 void addBindExpression(Expr* expr){return addExpression(expr, true);}
75
76
77 void addExpression(Expr* expr){return addExpression(expr, false);}
78
79signals:
81 void variableSelected(Variable* variable);
82
85
88
91
92private slots:
93 void onSelectionChanged();
94 void onAddVariable();
95 void onRemoveVariable();
96 void onCellChanged(int row, int column);
97 void onRefresh();
98
99private:
100 void setupUi();
101 bool eventFilter(QObject* obj, QEvent* event) override;
102 void syncOrderFromTable();
103
104 QVBoxLayout* mainLayout_;
105 QTableWidget* tableWidget_;
106 QHBoxLayout* buttonLayout_;
107 QToolButton* addButton_;
108 QToolButton* removeButton_;
109 QToolButton* refreshButton_;
110private:
111 VariableList* variableList_ = nullptr;
112 WeakPtr<Object> variableListOwner_;
113 Interpreter* interpreter_ = nullptr;
114 WeakPtr<Object> interpreterOwner_;
115};
116
117AST_NAMESPACE_END
表达式基类
定义 Expr.hpp:40
解释器
定义 Interpreter.hpp:40
对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能
定义 Object.hpp:95
变量列表编辑控件,以表格形式管理脚本变量的增删改
定义 UiVariableList.hpp:38
void variableSelected(Variable *variable)
选中变量变化
void variableFocused()
用户选中了变量(用于通知外部联动控件)
void addBindExpression(Expr *expr)
输入表达式,新建与表达式双向绑定的变量并追加到列表末尾
定义 UiVariableList.hpp:74
void variableDoubleClicked(Variable *variable)
用户双击了某个变量行
void variableListChanged()
变量列表已修改(增/删/编辑/拖拽排序)
变量列表
定义 VariableList.hpp:38
变量
定义 Variable.hpp:40
弱引用指针
定义 WeakPtr.hpp:35