🛰️航天仿真算法库 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 UiVariableList(const UiVariableList&) = delete;
43 UiVariableList& operator=(const UiVariableList&) = delete;
44
48 void setVariableList(VariableList* variableList, Object* owner);
49
53 void setInterpreter(Interpreter* interpreter, Object* owner);
54
56 void setToolbarVisible(bool visible);
57
59 void refreshUi();
60
62 Variable* selectedVariable() const;
63
65 VariableList* variableList() const;
66
68 Interpreter* interpreter() const;
69
72 void addExpression(Expr* expr, bool bind);
73
76 void addBindExpression(Expr* expr){return addExpression(expr, true);}
77
78
79 void addExpression(Expr* expr){return addExpression(expr, false);}
80
81signals:
83 void variableSelected(Variable* variable);
84
87
90
93
94private slots:
95 void onSelectionChanged();
96 void onAddVariable();
97 void onRemoveVariable();
98 void onCellChanged(int row, int column);
99 void onRefresh();
100
101private:
102 void setupUi();
103 bool eventFilter(QObject* obj, QEvent* event) override;
104 void syncOrderFromTable();
105
106 QVBoxLayout* mainLayout_{};
107 QTableWidget* tableWidget_{};
108 QHBoxLayout* buttonLayout_{};
109 QToolButton* addButton_{};
110 QToolButton* removeButton_{};
111 QToolButton* refreshButton_{};
112private:
113 VariableList* variableList_ = nullptr;
114 WeakPtr<Object> variableListOwner_{};
115 Interpreter* interpreter_ = nullptr;
116 WeakPtr<Object> interpreterOwner_{};
117};
118
119AST_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:76
void variableDoubleClicked(Variable *variable)
用户双击了某个变量行
void variableListChanged()
变量列表已修改(增/删/编辑/拖拽排序)
变量列表
定义 VariableList.hpp:38
变量
定义 Variable.hpp:40