2025-01-04 04:12:51 +00:00
|
|
|
#include "PropertyBrowser.h"
|
|
|
|
|
|
|
|
|
|
#include <QBoxLayout>
|
|
|
|
|
#include <QDebug>
|
2025-11-03 15:52:10 +00:00
|
|
|
#include <QSet>
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
#include "PropertyBrowser/qttreepropertybrowser.h"
|
|
|
|
|
#include "PropertyBrowser/qtpropertymanager.h"
|
|
|
|
|
#include "PropertyBrowser/qteditorfactory.h"
|
|
|
|
|
|
|
|
|
|
#include "DockTitleBar.h"
|
|
|
|
|
#include "DockWidget.h"
|
|
|
|
|
#include "workspace/WorkSpace.h"
|
2025-11-09 05:18:21 +00:00
|
|
|
#include "workspace/WorkSpaceManager.h"
|
2025-01-04 04:12:51 +00:00
|
|
|
#include "entities/Entity.h"
|
|
|
|
|
#include "entities/MeshComponent.h"
|
|
|
|
|
|
|
|
|
|
#include "common/SpdLogger.h"
|
|
|
|
|
|
|
|
|
|
PropertyBrowser::PropertyBrowser(QWidget *parent) :
|
|
|
|
|
QWidget(parent) {
|
|
|
|
|
|
|
|
|
|
InitUI();
|
|
|
|
|
|
|
|
|
|
//Test();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyBrowser::~PropertyBrowser() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBrowser::AttachDock(DockWidget* dockWidget) {
|
|
|
|
|
if (nullptr == dockWidget) {
|
|
|
|
|
LOG_WARN("dockwidget is nullptr");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dockWidget->SetDockWidgetTitleBar(nullptr);
|
|
|
|
|
dockWidget->setWidget(this);
|
|
|
|
|
|
|
|
|
|
DockTitleBar* dockTitleBar = new DockTitleBar;
|
|
|
|
|
dockTitleBar->SetTitle(tr("attribute"));
|
|
|
|
|
dockWidget->SetDockWidgetTitleBar(dockTitleBar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBrowser::OnWorkSpaceChange(const QVariant& value) {
|
2025-11-03 16:23:24 +00:00
|
|
|
inFileEntryView_ = false;
|
2025-01-04 04:12:51 +00:00
|
|
|
WorkSpace* workspace = value.value<WorkSpace*>();
|
|
|
|
|
if (nullptr == workspace) {
|
|
|
|
|
LOG_WARN("workspace is nullptr");
|
2025-11-09 05:18:21 +00:00
|
|
|
// 如果没有属性对象,清空属性面板
|
|
|
|
|
browser_->clear();
|
|
|
|
|
propertyToId_.clear();
|
|
|
|
|
idToProperty_.clear();
|
|
|
|
|
idToExpanded_.clear();
|
|
|
|
|
colorSetters_.clear();
|
2025-01-04 04:12:51 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
// 点击根项目需要清空属性面板,不展示工作区属性
|
2025-01-04 04:12:51 +00:00
|
|
|
browser_->clear();
|
2025-11-03 15:52:10 +00:00
|
|
|
propertyToId_.clear();
|
|
|
|
|
idToProperty_.clear();
|
|
|
|
|
idToExpanded_.clear();
|
2025-11-09 05:18:21 +00:00
|
|
|
colorSetters_.clear();
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
QtProperty* property;
|
|
|
|
|
|
|
|
|
|
property = workSpaceManager_->addProperty(tr("WorkSpace"));
|
|
|
|
|
QWorkspaceAttribute worksapceAttribute(workspace);
|
|
|
|
|
workSpaceManager_->setValue(property, worksapceAttribute);
|
|
|
|
|
addProperty(property, tr("WorkSpace"));
|
2025-10-12 14:14:16 +00:00
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
// 保持对运行时工作区变更的监听(树刷新所需),但属性面板保持清空
|
2025-10-12 14:14:16 +00:00
|
|
|
if (currentWorkspace_) {
|
|
|
|
|
QObject::disconnect(currentWorkspace_, nullptr, this, nullptr);
|
|
|
|
|
}
|
|
|
|
|
currentWorkspace_ = workspace;
|
|
|
|
|
QObject::connect(currentWorkspace_, &WorkSpace::FilesChanged,
|
|
|
|
|
this, &PropertyBrowser::OnWorkspaceFilesChanged);
|
2025-11-02 16:36:16 +00:00
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
// 属性面板清空,文件项属性由 FileEntry 点击时单独处理
|
2025-01-04 04:12:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBrowser::OnEntityChange(const QVariant& value) {
|
2025-11-03 16:23:24 +00:00
|
|
|
inFileEntryView_ = false;
|
2025-01-04 04:12:51 +00:00
|
|
|
Entity* entity = value.value<Entity*>();
|
|
|
|
|
if (nullptr == entity) {
|
|
|
|
|
LOG_WARN("engity is nullptr");
|
2025-11-09 05:18:21 +00:00
|
|
|
// 如果没有属性对象,清空属性面板
|
|
|
|
|
browser_->clear();
|
|
|
|
|
propertyToId_.clear();
|
|
|
|
|
idToProperty_.clear();
|
|
|
|
|
idToExpanded_.clear();
|
|
|
|
|
colorSetters_.clear();
|
2025-01-04 04:12:51 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
browser_->clear();
|
|
|
|
|
|
|
|
|
|
QtProperty* property;
|
|
|
|
|
property = entityManager_->addProperty(tr("Entity"));
|
|
|
|
|
QEntityAttribute entityAttribute(entity);
|
|
|
|
|
entityManager_->setValue(property, entityAttribute);
|
|
|
|
|
addProperty(property, tr("Entity"));
|
|
|
|
|
|
|
|
|
|
SceneComponent* component = entity->GetRootComponent();
|
|
|
|
|
if (nullptr == component) {
|
|
|
|
|
LOG_WARN("component is nullptr");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtComponentPropertyManager* componentManager = GetCompononetPropertyManager(component->GetSelfTypeName().c_str());
|
|
|
|
|
if (nullptr == componentManager) {
|
|
|
|
|
LOG_WARN("component is nullptr");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
property = componentManager->AddProperty();
|
|
|
|
|
componentManager->SetPropertyValue(property, component);
|
|
|
|
|
addProperty(property, componentManager->GetPropertyId());
|
|
|
|
|
|
|
|
|
|
std::vector<SceneComponent*> children = component->GetChildren();
|
|
|
|
|
for (auto child : children) {
|
|
|
|
|
componentManager = GetCompononetPropertyManager(child->GetSelfTypeName().c_str());
|
2025-06-22 08:27:44 +00:00
|
|
|
if (nullptr == componentManager) {
|
|
|
|
|
LOG_WARN("component is nullptr id {}", child->GetSelfTypeName());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
if (nullptr == child) {
|
|
|
|
|
LOG_WARN("component is nullptr id {}", child->GetSelfTypeName());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
property = componentManager->AddProperty();
|
|
|
|
|
componentManager->SetPropertyValue(property, child);
|
|
|
|
|
addProperty(property, componentManager->GetPropertyId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-03 16:23:24 +00:00
|
|
|
void PropertyBrowser::OnFileEntryChange(const QVariant& value) {
|
|
|
|
|
FileEntry* entry = value.value<FileEntry*>();
|
|
|
|
|
if (!entry) {
|
|
|
|
|
LOG_WARN("file entry is nullptr");
|
2025-11-09 05:18:21 +00:00
|
|
|
// 如果没有属性对象,清空属性面板
|
|
|
|
|
inFileEntryView_ = false;
|
|
|
|
|
browser_->clear();
|
|
|
|
|
propertyToId_.clear();
|
|
|
|
|
idToProperty_.clear();
|
|
|
|
|
idToExpanded_.clear();
|
|
|
|
|
colorSetters_.clear();
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_.clear();
|
|
|
|
|
intSetters_.clear();
|
|
|
|
|
doubleSetters_.clear();
|
|
|
|
|
|
2025-11-03 16:23:24 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Enter single FileEntry view mode and clear existing panels
|
|
|
|
|
inFileEntryView_ = true;
|
|
|
|
|
browser_->clear();
|
|
|
|
|
propertyToId_.clear();
|
|
|
|
|
idToProperty_.clear();
|
|
|
|
|
idToExpanded_.clear();
|
2025-11-11 09:44:56 +00:00
|
|
|
colorSetters_.clear();
|
|
|
|
|
stringSetters_.clear();
|
|
|
|
|
intSetters_.clear();
|
|
|
|
|
doubleSetters_.clear();
|
2025-11-03 16:23:24 +00:00
|
|
|
|
|
|
|
|
// Compute our id and ensure the property exists (create if missing)
|
2025-11-11 09:44:56 +00:00
|
|
|
//const QString id = QString("CurveEntry:%1").arg(entry->GetFileName());
|
|
|
|
|
//auto curve = entry->AsCurve();
|
|
|
|
|
//if (!curve)
|
|
|
|
|
{
|
2025-11-03 16:23:24 +00:00
|
|
|
LOG_WARN("file entry not a curve: %s", entry->GetFileName().toStdString().c_str());
|
2025-11-09 05:18:21 +00:00
|
|
|
// 基础信息组
|
|
|
|
|
const QString idBasic = QString("FileEntry:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString titleBasic = QString("File Entry - %1").arg(entry->GetName());
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* groupBasic = groupManager_->addProperty(tr("Basic"));
|
2025-11-09 05:18:21 +00:00
|
|
|
|
|
|
|
|
QtProperty* typeProp = stringManager_->addProperty(tr("Type"));
|
|
|
|
|
stringManager_->setValue(typeProp, QString::fromStdString(FileEntryTypeToString(entry->GetType())));
|
2025-11-11 09:44:56 +00:00
|
|
|
typeProp->setEnabled(false);
|
2025-11-09 05:18:21 +00:00
|
|
|
groupBasic->addSubProperty(typeProp);
|
|
|
|
|
|
|
|
|
|
QtProperty* nameProp = stringManager_->addProperty(tr("Name"));
|
|
|
|
|
stringManager_->setValue(nameProp, entry->GetName());
|
|
|
|
|
groupBasic->addSubProperty(nameProp);
|
|
|
|
|
|
2025-11-11 09:44:56 +00:00
|
|
|
stringSetters_[nameProp] = [entry](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
entry->SetName(s);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* fileProp = stringManager_->addProperty(tr("FileName"));
|
|
|
|
|
stringManager_->setValue(fileProp, entry->GetFileName());
|
2025-11-11 09:44:56 +00:00
|
|
|
fileProp->setEnabled(false);
|
2025-11-09 05:18:21 +00:00
|
|
|
groupBasic->addSubProperty(fileProp);
|
|
|
|
|
|
|
|
|
|
QtProperty* pathProp = stringManager_->addProperty(tr("Path"));
|
|
|
|
|
stringManager_->setValue(pathProp, entry->GetPath());
|
2025-11-11 09:44:56 +00:00
|
|
|
pathProp->setEnabled(false);
|
2025-11-09 05:18:21 +00:00
|
|
|
groupBasic->addSubProperty(pathProp);
|
|
|
|
|
|
|
|
|
|
addProperty(groupBasic, idBasic);
|
|
|
|
|
|
|
|
|
|
// 类型专属属性显示
|
2025-11-11 09:44:56 +00:00
|
|
|
switch (entry->GetType())
|
|
|
|
|
{
|
|
|
|
|
case FileEntryType::Curve:
|
|
|
|
|
{
|
|
|
|
|
auto curve = entry->AsCurve();
|
|
|
|
|
if (curve)
|
|
|
|
|
{
|
|
|
|
|
const QString titleChart = QString(tr("Chart"));
|
|
|
|
|
QtProperty* chartGroup = groupManager_->addProperty(titleChart);
|
|
|
|
|
|
|
|
|
|
const auto& chart = curve->GetChartProperties();
|
|
|
|
|
QtProperty* typeProp = enumManager_->addProperty(tr("Curve Type"));
|
|
|
|
|
enumManager_->setEnumNames(typeProp, QStringList() << ("Wave") << ("Report"));
|
|
|
|
|
int enumVal = (chart.chartType == ChartType::Report) ? 1 : 0;
|
|
|
|
|
enumManager_->setValue(typeProp, enumVal);
|
|
|
|
|
typeProp->setEnabled(false);
|
|
|
|
|
chartGroup->addSubProperty(typeProp);
|
|
|
|
|
QtProperty* xCountProp = intManager_->addProperty(tr("xCount"));
|
|
|
|
|
intManager_->setValue(xCountProp, chart.xCount);
|
|
|
|
|
chartGroup->addSubProperty(xCountProp);
|
|
|
|
|
|
|
|
|
|
intSetters_[xCountProp] = [curve, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.xCount = value;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* yCountProp = intManager_->addProperty(tr("yCount"));
|
|
|
|
|
intManager_->setValue(yCountProp, chart.yCount);
|
|
|
|
|
chartGroup->addSubProperty(yCountProp);
|
|
|
|
|
|
|
|
|
|
intSetters_[yCountProp] = [curve, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.yCount = value;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* xTitleProp = stringManager_->addProperty(tr("xTitle"));
|
|
|
|
|
stringManager_->setValue(xTitleProp, chart.xTitle);
|
|
|
|
|
chartGroup->addSubProperty(xTitleProp);
|
|
|
|
|
|
|
|
|
|
stringSetters_[xTitleProp] = [curve, entry](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.xTitle = s;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* yTitleProp = stringManager_->addProperty(tr("yTitle"));
|
|
|
|
|
stringManager_->setValue(yTitleProp, chart.yTitle);
|
|
|
|
|
chartGroup->addSubProperty(yTitleProp);
|
|
|
|
|
|
|
|
|
|
stringSetters_[yTitleProp] = [curve, entry](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.yTitle = s;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* xMinProp = doubleManager_->addProperty(tr("xMin"));
|
|
|
|
|
doubleManager_->setValue(xMinProp, chart.xMin);
|
|
|
|
|
chartGroup->addSubProperty(xMinProp);
|
|
|
|
|
|
|
|
|
|
doubleSetters_[xMinProp] = [curve, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.xMin = value;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* xMaxProp = doubleManager_->addProperty(tr("xMax"));
|
|
|
|
|
doubleManager_->setValue(xMaxProp, chart.xMax);
|
|
|
|
|
chartGroup->addSubProperty(xMaxProp);
|
|
|
|
|
|
|
|
|
|
doubleSetters_[xMaxProp] = [curve, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.xMax = value;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* yMinProp = doubleManager_->addProperty(tr("yMin"));
|
|
|
|
|
doubleManager_->setValue(yMinProp, chart.yMin);
|
|
|
|
|
chartGroup->addSubProperty(yMinProp);
|
|
|
|
|
|
|
|
|
|
doubleSetters_[yMinProp] = [curve, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.yMin = value;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* yMaxProp = doubleManager_->addProperty(tr("yMax"));
|
|
|
|
|
doubleManager_->setValue(yMaxProp, chart.yMax);
|
|
|
|
|
chartGroup->addSubProperty(yMaxProp);
|
|
|
|
|
|
|
|
|
|
doubleSetters_[yMaxProp] = [curve, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.yMax = value;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* tProp = intManager_->addProperty(tr("timeParam"));
|
|
|
|
|
intManager_->setValue(tProp, chart.timeParam);
|
|
|
|
|
chartGroup->addSubProperty(tProp);
|
|
|
|
|
|
|
|
|
|
intSetters_[tProp] = [curve, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = curve->GetChartProperties();
|
|
|
|
|
prop.timeParam = value;
|
|
|
|
|
curve->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
addProperty(chartGroup, "CurveChart");
|
|
|
|
|
|
|
|
|
|
QtProperty* itemsGroup = groupManager_->addProperty(tr("CurveProperty"));
|
|
|
|
|
const auto& items = curve->GetCurveProperties();
|
|
|
|
|
for (int i = 0; i < items.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
const auto& s = items[i];
|
|
|
|
|
QtProperty* itemGroup = groupManager_->addProperty(QString("Curve[%1]").arg(i));
|
|
|
|
|
|
|
|
|
|
QtProperty* nm = stringManager_->addProperty(tr("name"));
|
|
|
|
|
stringManager_->setValue(nm, s.name);
|
|
|
|
|
itemGroup->addSubProperty(nm);
|
|
|
|
|
|
|
|
|
|
stringSetters_[nm] = [curve, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = curve->GetCurveProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.name = s;
|
|
|
|
|
curve->SetCurveProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* col = colorManager_->addProperty(tr("color"));
|
|
|
|
|
colorManager_->setValue(col, s.color);
|
|
|
|
|
itemGroup->addSubProperty(col);
|
|
|
|
|
|
|
|
|
|
colorSetters_[col] = [curve, entry, i](const QColor& c)
|
|
|
|
|
{
|
|
|
|
|
auto props = curve->GetCurveProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.color = c;
|
|
|
|
|
curve->SetCurveProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (chart.chartType == ChartType::Wave)
|
|
|
|
|
{
|
|
|
|
|
QtProperty* st = intManager_->addProperty(tr("start"));
|
|
|
|
|
intManager_->setValue(st, s.data.wave.start);
|
|
|
|
|
itemGroup->addSubProperty(st);
|
|
|
|
|
QtProperty* sp = intManager_->addProperty(tr("stop"));
|
|
|
|
|
intManager_->setValue(sp, s.data.wave.stop);
|
|
|
|
|
itemGroup->addSubProperty(sp);
|
|
|
|
|
|
|
|
|
|
intSetters_[st] = [curve, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = curve->GetCurveProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.data.wave.start = value;
|
|
|
|
|
curve->SetCurveProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
intSetters_[sp] = [curve, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = curve->GetCurveProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.data.wave.stop = value;
|
|
|
|
|
curve->SetCurveProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else if (chart.chartType == ChartType::Report)
|
|
|
|
|
{
|
|
|
|
|
QtProperty* st = intManager_->addProperty(tr("x"));
|
|
|
|
|
intManager_->setValue(st, s.data.report.x);
|
|
|
|
|
itemGroup->addSubProperty(st);
|
|
|
|
|
QtProperty* sp = intManager_->addProperty(tr("y"));
|
|
|
|
|
intManager_->setValue(sp, s.data.report.y);
|
|
|
|
|
itemGroup->addSubProperty(sp);
|
|
|
|
|
|
|
|
|
|
intSetters_[st] = [curve, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = curve->GetCurveProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.data.report.x = value;
|
|
|
|
|
curve->SetCurveProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
intSetters_[sp] = [curve, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = curve->GetCurveProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.data.report.y = value;
|
|
|
|
|
curve->SetCurveProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
itemsGroup->addSubProperty(itemGroup);
|
|
|
|
|
}
|
|
|
|
|
addProperty(itemsGroup, "CurveItems");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case FileEntryType::Surface:
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto surf = entry->AsSurface();
|
2025-11-11 09:44:56 +00:00
|
|
|
if (surf)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const QString idChart = QString("SurfaceChart:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString idItems = QString("SurfaceItems:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString titleChart = QString("Surface Chart - %1").arg(entry->GetName());
|
|
|
|
|
const QString titleItems = QString("Surfaces - %1").arg(entry->GetName());
|
|
|
|
|
|
|
|
|
|
// Chart 属性
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* chartGroup = groupManager_->addProperty(tr("Chart"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& chart = surf->GetChartProperties();
|
|
|
|
|
QtProperty* xCountProp = intManager_->addProperty(tr("xCount"));
|
|
|
|
|
intManager_->setValue(xCountProp, chart.xCount);
|
|
|
|
|
chartGroup->addSubProperty(xCountProp);
|
|
|
|
|
QtProperty* yCountProp = intManager_->addProperty(tr("yCount"));
|
|
|
|
|
intManager_->setValue(yCountProp, chart.yCount);
|
|
|
|
|
chartGroup->addSubProperty(yCountProp);
|
|
|
|
|
QtProperty* zCountProp = intManager_->addProperty(tr("zCount"));
|
|
|
|
|
intManager_->setValue(zCountProp, chart.zCount);
|
|
|
|
|
chartGroup->addSubProperty(zCountProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[xCountProp] = [surf, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.xCount = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
intSetters_[yCountProp] = [surf, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.yCount = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
intSetters_[zCountProp] = [surf, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.zCount = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* xTitleProp = stringManager_->addProperty(tr("xTitle"));
|
|
|
|
|
stringManager_->setValue(xTitleProp, chart.xTitle);
|
|
|
|
|
chartGroup->addSubProperty(xTitleProp);
|
|
|
|
|
QtProperty* yTitleProp = stringManager_->addProperty(tr("yTitle"));
|
|
|
|
|
stringManager_->setValue(yTitleProp, chart.yTitle);
|
|
|
|
|
chartGroup->addSubProperty(yTitleProp);
|
|
|
|
|
QtProperty* zTitleProp = stringManager_->addProperty(tr("zTitle"));
|
|
|
|
|
stringManager_->setValue(zTitleProp, chart.zTitle);
|
|
|
|
|
chartGroup->addSubProperty(zTitleProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[xTitleProp] = [surf, entry](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.xTitle = s;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
stringSetters_[yTitleProp] = [surf, entry](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.yTitle = s;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
stringSetters_[zTitleProp] = [surf, entry](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.zTitle = s;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* xMinProp = doubleManager_->addProperty(tr("xMin"));
|
|
|
|
|
doubleManager_->setValue(xMinProp, chart.xMin);
|
|
|
|
|
chartGroup->addSubProperty(xMinProp);
|
|
|
|
|
QtProperty* xMaxProp = doubleManager_->addProperty(tr("xMax"));
|
|
|
|
|
doubleManager_->setValue(xMaxProp, chart.xMax);
|
|
|
|
|
chartGroup->addSubProperty(xMaxProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
doubleSetters_[xMinProp] = [surf, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.xMin = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
doubleSetters_[xMaxProp] = [surf, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.xMax = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* yMinProp = doubleManager_->addProperty(tr("yMin"));
|
|
|
|
|
doubleManager_->setValue(yMinProp, chart.yMin);
|
|
|
|
|
chartGroup->addSubProperty(yMinProp);
|
|
|
|
|
QtProperty* yMaxProp = doubleManager_->addProperty(tr("yMax"));
|
|
|
|
|
doubleManager_->setValue(yMaxProp, chart.yMax);
|
|
|
|
|
chartGroup->addSubProperty(yMaxProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
doubleSetters_[yMinProp] = [surf, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.yMin = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
doubleSetters_[yMaxProp] = [surf, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.yMax = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* zMinProp = doubleManager_->addProperty(tr("zMin"));
|
|
|
|
|
doubleManager_->setValue(zMinProp, chart.zMin);
|
|
|
|
|
chartGroup->addSubProperty(zMinProp);
|
|
|
|
|
QtProperty* zMaxProp = doubleManager_->addProperty(tr("zMax"));
|
|
|
|
|
doubleManager_->setValue(zMaxProp, chart.zMax);
|
|
|
|
|
chartGroup->addSubProperty(zMaxProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
doubleSetters_[zMinProp] = [surf, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.zMin = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
doubleSetters_[zMaxProp] = [surf, entry](const double& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.zMax = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* tProp = intManager_->addProperty(tr("timeParam"));
|
|
|
|
|
intManager_->setValue(tProp, chart.timeParam);
|
2025-11-09 05:18:21 +00:00
|
|
|
chartGroup->addSubProperty(tProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[zCountProp] = [surf, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = surf->GetChartProperties();
|
|
|
|
|
prop.timeParam = value;
|
|
|
|
|
surf->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
addProperty(chartGroup, idChart);
|
|
|
|
|
|
|
|
|
|
// Surface 列表
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* itemsGroup = groupManager_->addProperty(tr("SurfacesProp"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& items = surf->GetSurfaceProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
for (int i = 0; i < items.size(); ++i)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& s = items[i];
|
|
|
|
|
QtProperty* itemGroup = groupManager_->addProperty(QString("Surface[%1]").arg(i));
|
|
|
|
|
QtProperty* nm = stringManager_->addProperty(tr("name"));
|
|
|
|
|
stringManager_->setValue(nm, s.name);
|
|
|
|
|
itemGroup->addSubProperty(nm);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[nm] = [surf, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = surf->GetSurfaceProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.name = s;
|
|
|
|
|
surf->SetSurfaceProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* col = colorManager_->addProperty(tr("color"));
|
|
|
|
|
colorManager_->setValue(col, s.color);
|
|
|
|
|
itemGroup->addSubProperty(col);
|
|
|
|
|
// 写回 Surface 条目颜色
|
2025-11-11 09:44:56 +00:00
|
|
|
colorSetters_[col] = [surf, entry, i](const QColor& c)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto props = surf->GetSurfaceProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto item = props[i];
|
|
|
|
|
item.color = c;
|
|
|
|
|
surf->SetSurfaceProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
QtProperty* st = intManager_->addProperty(tr("start"));
|
|
|
|
|
intManager_->setValue(st, s.start);
|
|
|
|
|
itemGroup->addSubProperty(st);
|
|
|
|
|
QtProperty* sp = intManager_->addProperty(tr("stop"));
|
|
|
|
|
intManager_->setValue(sp, s.stop);
|
|
|
|
|
itemGroup->addSubProperty(sp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[st] = [surf, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = surf->GetSurfaceProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.start = value;
|
|
|
|
|
surf->SetSurfaceProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
intSetters_[sp] = [surf, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = surf->GetSurfaceProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.stop = value;
|
|
|
|
|
surf->SetSurfaceProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* x = stringManager_->addProperty(tr("x"));
|
|
|
|
|
stringManager_->setValue(x, s.x);
|
|
|
|
|
itemGroup->addSubProperty(x);
|
|
|
|
|
QtProperty* y = stringManager_->addProperty(tr("y"));
|
|
|
|
|
stringManager_->setValue(y, s.y);
|
|
|
|
|
itemGroup->addSubProperty(y);
|
|
|
|
|
QtProperty* z = stringManager_->addProperty(tr("z"));
|
|
|
|
|
stringManager_->setValue(z, s.z);
|
|
|
|
|
itemGroup->addSubProperty(z);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[x] = [surf, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = surf->GetSurfaceProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.x = s;
|
|
|
|
|
surf->SetSurfaceProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
stringSetters_[y] = [surf, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = surf->GetSurfaceProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.y = s;
|
|
|
|
|
surf->SetSurfaceProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
stringSetters_[z] = [surf, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = surf->GetSurfaceProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.z = s;
|
|
|
|
|
surf->SetSurfaceProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
itemsGroup->addSubProperty(itemGroup);
|
|
|
|
|
}
|
|
|
|
|
addProperty(itemsGroup, idItems);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2025-11-11 09:44:56 +00:00
|
|
|
case FileEntryType::Table:
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto tbl = entry->AsTable();
|
2025-11-11 09:44:56 +00:00
|
|
|
if (tbl)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const QString idChart = QString("TableChart:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString idItems = QString("TableItems:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString titleChart = QString("Table Chart - %1").arg(entry->GetName());
|
|
|
|
|
const QString titleItems = QString("Tables - %1").arg(entry->GetName());
|
|
|
|
|
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* chartGroup = groupManager_->addProperty(tr("Chart"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& chart = tbl->GetChartProperties();
|
|
|
|
|
QtProperty* headerProp = stringManager_->addProperty(tr("headerString"));
|
|
|
|
|
stringManager_->setValue(headerProp, chart.headerString);
|
|
|
|
|
chartGroup->addSubProperty(headerProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[headerProp] = [tbl, entry](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto prop = tbl->GetChartProperties();
|
|
|
|
|
prop.headerString = s;
|
|
|
|
|
tbl->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QtProperty* tProp = intManager_->addProperty(tr("timeParam"));
|
|
|
|
|
intManager_->setValue(tProp, chart.timeParam);
|
2025-11-09 05:18:21 +00:00
|
|
|
chartGroup->addSubProperty(tProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[tProp] = [tbl, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = tbl->GetChartProperties();
|
|
|
|
|
prop.timeParam = value;
|
|
|
|
|
tbl->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
addProperty(chartGroup, idChart);
|
|
|
|
|
|
2025-11-11 09:44:56 +00:00
|
|
|
// QtProperty* itemsGroup = groupManager_->addProperty(titleItems);
|
|
|
|
|
// const auto& items = tbl->GetTableProperties();
|
|
|
|
|
// for (int i = 0; i < items.size(); ++i)
|
|
|
|
|
//{
|
|
|
|
|
// const auto& t = items[i];
|
|
|
|
|
// QtProperty* itemGroup = groupManager_->addProperty(QString("Table[%1]").arg(i));
|
|
|
|
|
// QtProperty* nm = stringManager_->addProperty(tr("name"));
|
|
|
|
|
// stringManager_->setValue(nm, t.name);
|
|
|
|
|
// itemGroup->addSubProperty(nm);
|
|
|
|
|
// QtProperty* col = colorManager_->addProperty(tr("color"));
|
|
|
|
|
// colorManager_->setValue(col, t.color);
|
|
|
|
|
// itemGroup->addSubProperty(col);
|
|
|
|
|
// // 写回 Table 条目颜色
|
|
|
|
|
// colorSetters_[col] = [tbl, entry, i](const QColor& c){
|
|
|
|
|
// auto props = tbl->GetTableProperties();
|
|
|
|
|
// if (i >= 0 && i < props.size()) {
|
|
|
|
|
// auto item = props[i];
|
|
|
|
|
// item.color = c;
|
|
|
|
|
// tbl->SetTableProperty(i, item);
|
|
|
|
|
// if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// // datas 展示为拼接字符串
|
|
|
|
|
// QStringList values;
|
|
|
|
|
// for (const auto& v : t.datas) values << QString::number(v);
|
|
|
|
|
// QtProperty* ds = stringManager_->addProperty(tr("datas"));
|
|
|
|
|
// stringManager_->setValue(ds, values.join(", "));
|
|
|
|
|
// itemGroup->addSubProperty(ds);
|
|
|
|
|
// itemsGroup->addSubProperty(itemGroup);
|
|
|
|
|
// }
|
|
|
|
|
// addProperty(itemsGroup, idItems);
|
2025-11-09 05:18:21 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2025-11-11 09:44:56 +00:00
|
|
|
case FileEntryType::Light:
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto lt = entry->AsLight();
|
2025-11-11 09:44:56 +00:00
|
|
|
if (lt)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const QString idColor = QString("LightColors:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString idRows = QString("LightRows:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString titleColor = QString("Light Colors - %1").arg(entry->GetName());
|
|
|
|
|
const QString titleRows = QString("Light Rows - %1").arg(entry->GetName());
|
|
|
|
|
|
|
|
|
|
// 颜色与时间
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* colorGroup = groupManager_->addProperty(tr("Chart"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& colorProps = lt->GetColorProperties();
|
|
|
|
|
QtProperty* oc = colorManager_->addProperty(tr("openColor"));
|
|
|
|
|
colorManager_->setValue(oc, colorProps.openColor);
|
|
|
|
|
colorGroup->addSubProperty(oc);
|
|
|
|
|
QtProperty* cc = colorManager_->addProperty(tr("closeColor"));
|
|
|
|
|
colorManager_->setValue(cc, colorProps.closeColor);
|
|
|
|
|
colorGroup->addSubProperty(cc);
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* tProp = intManager_->addProperty(tr("timeParam"));
|
|
|
|
|
intManager_->setValue(tProp, colorProps.timeParam);
|
2025-11-09 05:18:21 +00:00
|
|
|
colorGroup->addSubProperty(tProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[tProp] = [lt, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = lt->GetColorProperties();
|
|
|
|
|
prop.timeParam = value;
|
|
|
|
|
lt->SetColorProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
addProperty(colorGroup, idColor);
|
|
|
|
|
// 写回处理:颜色变化更新到 FileEntryLight 并通知 Workspace
|
2025-11-11 09:44:56 +00:00
|
|
|
colorSetters_[oc] = [lt, entry](const QColor& c)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto props = lt->GetColorProperties();
|
|
|
|
|
props.openColor = c;
|
|
|
|
|
lt->SetColorProperties(props);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
2025-11-11 09:44:56 +00:00
|
|
|
colorSetters_[cc] = [lt, entry](const QColor& c)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto props = lt->GetColorProperties();
|
|
|
|
|
props.closeColor = c;
|
|
|
|
|
lt->SetColorProperties(props);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 行数据
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* rowsGroup = groupManager_->addProperty(tr("Light Rows"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& rows = lt->GetLightProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
for (int i = 0; i < rows.size(); ++i)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& r = rows[i];
|
|
|
|
|
QtProperty* row = groupManager_->addProperty(QString("Row[%1]").arg(i));
|
|
|
|
|
QtProperty* names = stringManager_->addProperty(tr("names"));
|
|
|
|
|
stringManager_->setValue(names, r.name.join(", "));
|
|
|
|
|
row->addSubProperty(names);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[names] = [lt, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = lt->GetLightProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
QStringList names = s.split(",", Qt::SkipEmptyParts);
|
|
|
|
|
for (int i = 0; i < names.size(); ++i) {
|
|
|
|
|
names[i] = names[i].trimmed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.name = names;
|
|
|
|
|
lt->SetLightProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QStringList values;
|
|
|
|
|
for (const auto& v : r.data) values << QString::number(v);
|
|
|
|
|
QtProperty* ds = stringManager_->addProperty(tr("data"));
|
|
|
|
|
stringManager_->setValue(ds, values.join(", "));
|
|
|
|
|
row->addSubProperty(ds);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[ds] = [lt, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = lt->GetLightProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
QStringList dataStrings = s.split(",", Qt::SkipEmptyParts);
|
|
|
|
|
QList<int> dataValues;
|
|
|
|
|
for (const QString& str : dataStrings)
|
|
|
|
|
{
|
|
|
|
|
bool ok;
|
|
|
|
|
int dataValue = str.trimmed().toInt(&ok);
|
|
|
|
|
if (ok) {
|
|
|
|
|
dataValues.append(dataValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.data = dataValues;
|
|
|
|
|
lt->SetLightProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
rowsGroup->addSubProperty(row);
|
|
|
|
|
}
|
|
|
|
|
addProperty(rowsGroup, idRows);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2025-11-11 09:44:56 +00:00
|
|
|
case FileEntryType::Polar:
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto pl = entry->AsPolar();
|
2025-11-11 09:44:56 +00:00
|
|
|
if (pl)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const QString idChart = QString("PolarChart:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString idLines = QString("PolarLines:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString titleChart = QString("Polar Chart - %1").arg(entry->GetName());
|
|
|
|
|
const QString titleLines = QString("Lines - %1").arg(entry->GetName());
|
|
|
|
|
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* chartGroup = groupManager_->addProperty(tr("Chart"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& chart = pl->GetChartProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
auto addInt = [&](const QString& label, int v, const QString& key)
|
|
|
|
|
{
|
|
|
|
|
QtProperty* p=intManager_->addProperty(label);
|
|
|
|
|
intManager_->setValue(p, v);
|
|
|
|
|
chartGroup->addSubProperty(p);
|
|
|
|
|
|
|
|
|
|
intSetters_[p] = [pl, entry, key](const int& value)
|
|
|
|
|
{
|
|
|
|
|
pl->UpdateChartProperties(key, QVariant(value));
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
auto addStr = [&](const QString& label, const QString& v, const QString& key)
|
|
|
|
|
{
|
|
|
|
|
QtProperty* p=stringManager_->addProperty(label);
|
|
|
|
|
stringManager_->setValue(p, v);
|
|
|
|
|
chartGroup->addSubProperty(p);
|
|
|
|
|
|
|
|
|
|
stringSetters_[p] = [pl, entry, key](const QString& value)
|
|
|
|
|
{
|
|
|
|
|
pl->UpdateChartProperties(key, QVariant(value));
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
auto addDbl = [&](const QString& label, double v, const QString& key)
|
|
|
|
|
{
|
|
|
|
|
QtProperty* p=doubleManager_->addProperty(label);
|
|
|
|
|
doubleManager_->setValue(p, v);
|
|
|
|
|
chartGroup->addSubProperty(p);
|
|
|
|
|
|
|
|
|
|
doubleSetters_[p] = [pl, entry, key](const double& value)
|
|
|
|
|
{
|
|
|
|
|
pl->UpdateChartProperties(key, QVariant(value));
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
addInt(tr("AngularCount"), chart.AngularCount, "AngularCount");
|
|
|
|
|
addInt(tr("RadialCount"), chart.RadialCount, "RadialCount");
|
|
|
|
|
addStr(tr("AngularTitle"), chart.AngularTitle, "AngularTitle");
|
|
|
|
|
addStr(tr("RadialTitle"), chart.RadialTitle, "RadialTitle");
|
|
|
|
|
addDbl(tr("AngularMin"), chart.AngularMin, "AngularMin");
|
|
|
|
|
addDbl(tr("AngularMax"), chart.AngularMax, "AngularMax");
|
|
|
|
|
addDbl(tr("RadialMin"), chart.RadialMin, "RadialMin");
|
|
|
|
|
addDbl(tr("RadialMax"), chart.RadialMax, "RadialMax");
|
|
|
|
|
addStr(tr("AngularUnit"), chart.AngularUnit, "AngularUnit");
|
|
|
|
|
addStr(tr("RadialUnit"), chart.RadialUnit, "RadialUnit");
|
|
|
|
|
addInt(tr("timeParam"), chart.timeParam, "timeParam");
|
2025-11-09 05:18:21 +00:00
|
|
|
addProperty(chartGroup, idChart);
|
|
|
|
|
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* linesGroup = groupManager_->addProperty(tr("Lines Prop"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& lines = pl->GetLineProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
for (int i = 0; i < lines.size(); ++i)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& ln = lines[i];
|
|
|
|
|
QtProperty* line = groupManager_->addProperty(QString("Line[%1]").arg(i));
|
|
|
|
|
QtProperty* nm = stringManager_->addProperty(tr("name"));
|
|
|
|
|
stringManager_->setValue(nm, ln.name);
|
|
|
|
|
line->addSubProperty(nm);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[nm] = [pl, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = pl->GetLineProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.name = s;
|
|
|
|
|
pl->SetLineProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* col = colorManager_->addProperty(tr("color"));
|
|
|
|
|
colorManager_->setValue(col, ln.color);
|
|
|
|
|
line->addSubProperty(col);
|
|
|
|
|
// 写回 Polar 线颜色
|
2025-11-11 09:44:56 +00:00
|
|
|
colorSetters_[col] = [pl, entry, i](const QColor& c)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto props = pl->GetLineProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto item = props[i];
|
|
|
|
|
item.color = c;
|
|
|
|
|
pl->SetLineProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-11-11 09:44:56 +00:00
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* ag = intManager_->addProperty(tr("Angular"));
|
|
|
|
|
intManager_->setValue(ag, ln.Angular);
|
|
|
|
|
line->addSubProperty(ag);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[ag] = [pl, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = pl->GetLineProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.Angular = value;
|
|
|
|
|
pl->SetLineProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* rd = intManager_->addProperty(tr("Radial"));
|
|
|
|
|
intManager_->setValue(rd, ln.Radial);
|
|
|
|
|
line->addSubProperty(rd);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[rd] = [pl, entry, i](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto props = pl->GetLineProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.Radial = value;
|
|
|
|
|
pl->SetLineProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
linesGroup->addSubProperty(line);
|
|
|
|
|
}
|
|
|
|
|
addProperty(linesGroup, idLines);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2025-11-11 09:44:56 +00:00
|
|
|
case FileEntryType::Image:
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
auto img = entry->AsImage();
|
2025-11-11 09:44:56 +00:00
|
|
|
if (img)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const QString idChart = QString("ImageChart:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString idItems = QString("Images:%1").arg(entry->GetFileName());
|
|
|
|
|
const QString titleChart = QString("Image Chart - %1").arg(entry->GetName());
|
|
|
|
|
const QString titleItems = QString("Image Set - %1").arg(entry->GetName());
|
|
|
|
|
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* chartGroup = groupManager_->addProperty(tr("Chart"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& chart = img->GetChartProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* tProp = intManager_->addProperty(tr("timeParam"));
|
|
|
|
|
intManager_->setValue(tProp, chart.timeParam);
|
2025-11-09 05:18:21 +00:00
|
|
|
chartGroup->addSubProperty(tProp);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
intSetters_[tProp] = [img, entry](const int& value)
|
|
|
|
|
{
|
|
|
|
|
auto prop = img->GetChartProperties();
|
|
|
|
|
prop.timeParam = value;
|
|
|
|
|
img->SetChartProperties(prop);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
addProperty(chartGroup, idChart);
|
|
|
|
|
|
2025-11-11 09:44:56 +00:00
|
|
|
QtProperty* itemsGroup = groupManager_->addProperty(tr("Image Prop"));
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& items = img->GetImageProperties();
|
2025-11-11 09:44:56 +00:00
|
|
|
for (int i = 0; i < items.size(); ++i)
|
|
|
|
|
{
|
2025-11-09 05:18:21 +00:00
|
|
|
const auto& im = items[i];
|
|
|
|
|
QtProperty* item = groupManager_->addProperty(QString("Image[%1]").arg(i));
|
|
|
|
|
QtProperty* names = stringManager_->addProperty(tr("names"));
|
|
|
|
|
names->setToolTip(tr("File name list"));
|
|
|
|
|
stringManager_->setValue(names, im.names.join(", "));
|
|
|
|
|
item->addSubProperty(names);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[names] = [img, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = img->GetImageProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
QStringList names = s.split(",", Qt::SkipEmptyParts);
|
|
|
|
|
for (int i = 0; i < names.size(); ++i) {
|
|
|
|
|
names[i] = names[i].trimmed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.names = names;
|
|
|
|
|
img->SetImageProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QStringList values;
|
|
|
|
|
for (const auto& v : im.datas) values << QString::number(v);
|
|
|
|
|
QtProperty* ds = stringManager_->addProperty(tr("datas"));
|
|
|
|
|
ds->setToolTip(tr("Image data per file"));
|
|
|
|
|
stringManager_->setValue(ds, values.join(", "));
|
|
|
|
|
item->addSubProperty(ds);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[ds] = [img, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = img->GetImageProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
QStringList dataStrings = s.split(",", Qt::SkipEmptyParts);
|
|
|
|
|
QList<int> dataValues;
|
|
|
|
|
for (const QString& str : dataStrings)
|
|
|
|
|
{
|
|
|
|
|
bool ok;
|
|
|
|
|
int dataValue = str.trimmed().toInt(&ok);
|
|
|
|
|
if (ok) {
|
|
|
|
|
dataValues.append(dataValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.datas = dataValues;
|
|
|
|
|
img->SetImageProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* pth = stringManager_->addProperty(tr("path"));
|
|
|
|
|
stringManager_->setValue(pth, im.path);
|
2025-11-15 13:44:17 +00:00
|
|
|
pth->setEnabled(false);
|
2025-11-09 05:18:21 +00:00
|
|
|
item->addSubProperty(pth);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[ds] = [img, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = img->GetImageProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.path = s;
|
|
|
|
|
img->SetImageProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
QtProperty* sfx = stringManager_->addProperty(tr("suffix"));
|
|
|
|
|
stringManager_->setValue(sfx, im.suffix);
|
|
|
|
|
item->addSubProperty(sfx);
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
stringSetters_[ds] = [img, entry, i](const QString& s)
|
|
|
|
|
{
|
|
|
|
|
auto props = img->GetImageProperties();
|
|
|
|
|
if (i >= 0 && i < props.size())
|
|
|
|
|
{
|
|
|
|
|
auto item = props[i];
|
|
|
|
|
item.suffix = s;
|
|
|
|
|
img->SetImageProperty(i, item);
|
|
|
|
|
if (auto ws = WorkSpaceManager::Get().GetCurrent()) ws->NotifyFileEntryUpdated(entry->GetType());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
itemsGroup->addSubProperty(item);
|
|
|
|
|
}
|
|
|
|
|
addProperty(itemsGroup, idItems);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 聚焦基础信息组
|
|
|
|
|
if (groupBasic) {
|
|
|
|
|
QtBrowserItem* item = browser_->topLevelItem(groupBasic);
|
|
|
|
|
if (item) {
|
|
|
|
|
browser_->setExpanded(item, true);
|
|
|
|
|
browser_->setCurrentItem(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-11-03 16:23:24 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2025-11-11 09:44:56 +00:00
|
|
|
//const QString title = QString("CurveEntry - %1").arg(entry->GetName());
|
|
|
|
|
//QtProperty* prop = curveEntryManager_->addProperty(title);
|
|
|
|
|
//QCurveEntryAttribute attr(curve);
|
|
|
|
|
//curveEntryManager_->setValue(prop, attr);
|
|
|
|
|
//addProperty(prop, id);
|
|
|
|
|
|
|
|
|
|
//// Focus the corresponding group: expand and select it
|
|
|
|
|
//if (prop) {
|
|
|
|
|
// QtBrowserItem* item = browser_->topLevelItem(prop);
|
|
|
|
|
// if (item) {
|
|
|
|
|
// browser_->setExpanded(item, true);
|
|
|
|
|
// browser_->setCurrentItem(item);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2025-11-03 16:23:24 +00:00
|
|
|
}
|
|
|
|
|
|
2025-11-09 05:18:21 +00:00
|
|
|
void PropertyBrowser::OnGroupChange(const QVariant& value) {
|
|
|
|
|
browser_->clear();
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
void PropertyBrowser::InitUI() {
|
|
|
|
|
QBoxLayout* layout = new QVBoxLayout(this);
|
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
browser_ = new QtTreePropertyBrowser;
|
|
|
|
|
layout->addWidget(browser_);
|
|
|
|
|
|
2025-02-11 17:54:16 +00:00
|
|
|
browser_->setHeaderVisible(true);
|
2025-02-12 14:04:02 +00:00
|
|
|
//browser_->setResizeMode(QtTreePropertyBrowser::Stretch);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
InitPropertyManager();
|
|
|
|
|
InitComponentPropertyManager();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBrowser::InitPropertyManager() {
|
2025-11-11 09:44:56 +00:00
|
|
|
enumManager_ = new QtEnumPropertyManager(this);
|
2025-06-27 16:23:58 +00:00
|
|
|
intManager_ = new QtIntPropertyManager(this);
|
|
|
|
|
boolManager_ = new QtBoolPropertyManager(this);
|
2025-01-04 04:12:51 +00:00
|
|
|
doubleManager_ = new QtDoublePropertyManager(this);
|
|
|
|
|
stringManager_ = new QtStringPropertyManager(this);
|
|
|
|
|
colorManager_ = new QtColorPropertyManager(this);
|
|
|
|
|
fontManager_ = new QtFontPropertyManager(this);
|
|
|
|
|
pointManager_ = new QtPointPropertyManager(this);
|
|
|
|
|
sizeManager_ = new QtSizePropertyManager(this);
|
|
|
|
|
modelBaseManager_ = new QtModelBasePropertyManager(this);
|
|
|
|
|
workSpaceManager_ = new QtWorkspacePropertyManager(this);
|
|
|
|
|
entityManager_ = new QtEntityPropertyManager(this);
|
2025-11-02 16:36:16 +00:00
|
|
|
curveEntryManager_ = new QtCurveEntryPropertyManager(this);
|
2025-11-09 05:18:21 +00:00
|
|
|
groupManager_ = new QtGroupPropertyManager(this);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
QtDoubleSpinBoxFactory* doubleSpinBoxFactory = new QtDoubleSpinBoxFactory(this);
|
|
|
|
|
QtCheckBoxFactory* checkBoxFactory = new QtCheckBoxFactory(this);
|
|
|
|
|
QtSpinBoxFactory* spinBoxFactory = new QtSpinBoxFactory(this);
|
|
|
|
|
QtLineEditFactory* lineEditFactory = new QtLineEditFactory(this);
|
|
|
|
|
QtEnumEditorFactory* comboBoxFactory = new QtEnumEditorFactory(this);
|
2025-01-04 16:11:29 +00:00
|
|
|
QtFilePathFactory* filePathFactory = new QtFilePathFactory(this);
|
2025-11-02 16:36:16 +00:00
|
|
|
QtColorEditorFactory* colorFactory = new QtColorEditorFactory(this);
|
2025-01-04 04:12:51 +00:00
|
|
|
//QtTransfromEditorFactory* transformFactory = new QtTransfromEditorFactory(this);
|
|
|
|
|
|
2025-06-27 16:23:58 +00:00
|
|
|
browser_->setFactoryForManager(intManager_, spinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(boolManager_, checkBoxFactory);
|
2025-01-04 04:12:51 +00:00
|
|
|
browser_->setFactoryForManager(doubleManager_, doubleSpinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(stringManager_, lineEditFactory);
|
2025-11-09 05:18:21 +00:00
|
|
|
// Color properties: use a color dialog editor for the top-level color, keep sub-channel ints editable
|
|
|
|
|
browser_->setFactoryForManager(colorManager_, colorFactory);
|
2025-01-04 04:12:51 +00:00
|
|
|
browser_->setFactoryForManager(colorManager_->subIntPropertyManager(), spinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(fontManager_->subIntPropertyManager(), spinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(fontManager_->subBoolPropertyManager(), checkBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(fontManager_->subEnumPropertyManager(), comboBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(pointManager_->subIntPropertyManager(), spinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(sizeManager_->subIntPropertyManager(), spinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(workSpaceManager_->subStringProperyManager(), lineEditFactory);
|
2025-01-04 16:11:29 +00:00
|
|
|
browser_->setFactoryForManager(workSpaceManager_->subFilesProperyManager(), filePathFactory);
|
2025-10-12 14:14:16 +00:00
|
|
|
// Enable editing for grouped file entry counts
|
|
|
|
|
browser_->setFactoryForManager(workSpaceManager_->subIntProperyManager(), spinBoxFactory);
|
2025-11-09 10:13:25 +00:00
|
|
|
// Enable editing for Workspace double sub-properties (e.g., HomeViewpoint fields)
|
|
|
|
|
browser_->setFactoryForManager(workSpaceManager_->subDoubleProperyManager(), doubleSpinBoxFactory);
|
2025-01-04 04:12:51 +00:00
|
|
|
browser_->setFactoryForManager(entityManager_->subStringProperyManager(), lineEditFactory);
|
2025-07-02 14:43:23 +00:00
|
|
|
browser_->setFactoryForManager(entityManager_->subBoolProperyManager(), checkBoxFactory);
|
2025-01-04 04:12:51 +00:00
|
|
|
browser_->setFactoryForManager(
|
|
|
|
|
entityManager_->subTransfromProperyManager()->subVec3TPropertyManager()->subDoublePropertyManager(),
|
|
|
|
|
doubleSpinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(
|
|
|
|
|
entityManager_->subTransfromProperyManager()->subVec3RPropertyManager()->subDoublePropertyManager(),
|
|
|
|
|
doubleSpinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(
|
|
|
|
|
entityManager_->subTransfromProperyManager()->subVec3SPropertyManager()->subDoublePropertyManager(),
|
|
|
|
|
doubleSpinBoxFactory);
|
2025-11-02 16:36:16 +00:00
|
|
|
|
|
|
|
|
// Curve entry sub editors
|
|
|
|
|
browser_->setFactoryForManager(curveEntryManager_->subStringProperyManager(), lineEditFactory);
|
|
|
|
|
browser_->setFactoryForManager(curveEntryManager_->subEnumProperyManager(), comboBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(curveEntryManager_->subIntProperyManager(), spinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(curveEntryManager_->subDoubleProperyManager(), doubleSpinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(curveEntryManager_->subColorProperyManager(), colorFactory);
|
2025-11-09 05:18:21 +00:00
|
|
|
|
|
|
|
|
// 颜色属性变更信号:触发对应写回处理器
|
|
|
|
|
connect(colorManager_, &QtColorPropertyManager::valueChanged, this,
|
|
|
|
|
[this](QtProperty* prop, const QColor& color){
|
|
|
|
|
if (colorSetters_.contains(prop)) {
|
|
|
|
|
colorSetters_[prop](color);
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-11-11 09:44:56 +00:00
|
|
|
|
|
|
|
|
connect(stringManager_, &QtStringPropertyManager::valueChanged, this,
|
|
|
|
|
[this](QtProperty* prop, const QString& str) {
|
|
|
|
|
if (stringSetters_.contains(prop)) {
|
|
|
|
|
stringSetters_[prop](str);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(intManager_, &QtIntPropertyManager::valueChanged, this,
|
|
|
|
|
[this](QtProperty* prop, const int& value) {
|
|
|
|
|
if (intSetters_.contains(prop)) {
|
|
|
|
|
intSetters_[prop](value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(doubleManager_, &QtDoublePropertyManager::valueChanged, this,
|
|
|
|
|
[this](QtProperty* prop, const double& value) {
|
|
|
|
|
if (doubleSetters_.contains(prop)) {
|
|
|
|
|
doubleSetters_[prop](value);
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-01-04 04:12:51 +00:00
|
|
|
}
|
|
|
|
|
|
2025-11-02 16:36:16 +00:00
|
|
|
void PropertyBrowser::OnWorkspaceFilesChanged(FileEntryType type, std::shared_ptr<FileEntry> fileEntry) {
|
2025-10-12 14:14:16 +00:00
|
|
|
if (!currentWorkspace_) return;
|
2025-11-03 16:23:24 +00:00
|
|
|
// In single FileEntry view, skip workspace-driven group refresh to keep panel clean
|
|
|
|
|
if (inFileEntryView_) return;
|
2025-11-02 16:36:16 +00:00
|
|
|
// Refresh workspace group
|
|
|
|
|
{
|
|
|
|
|
auto it = idToProperty_.find(tr("WorkSpace"));
|
|
|
|
|
if (it != idToProperty_.end()) {
|
|
|
|
|
QtProperty* property = it.value();
|
|
|
|
|
QWorkspaceAttribute worksapceAttribute(currentWorkspace_);
|
|
|
|
|
workSpaceManager_->setValue(property, worksapceAttribute);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-12 14:14:16 +00:00
|
|
|
}
|
|
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
void PropertyBrowser::InitComponentPropertyManager() {
|
|
|
|
|
QtDoubleSpinBoxFactory* doubleSpinBoxFactory = new QtDoubleSpinBoxFactory(this);
|
|
|
|
|
QtCheckBoxFactory* checkBoxFactory = new QtCheckBoxFactory(this);
|
|
|
|
|
QtSpinBoxFactory* spinBoxFactory = new QtSpinBoxFactory(this);
|
|
|
|
|
QtLineEditFactory* lineEditFactory = new QtLineEditFactory(this);
|
|
|
|
|
QtColorEditorFactory* colorFactory = new QtColorEditorFactory(this);
|
|
|
|
|
QtFilePathFactory* filePathFactory = new QtFilePathFactory(this);
|
2025-01-05 16:41:08 +00:00
|
|
|
QtModelFilePathFactory* modelFileFactory = new QtModelFilePathFactory(this);
|
2025-01-04 04:12:51 +00:00
|
|
|
QtEntityUUIDEditorFactory* entityUUIDFactory = new QtEntityUUIDEditorFactory(this);
|
|
|
|
|
|
|
|
|
|
QtMeshComponetManager* meshComponentManager = new QtMeshComponetManager(this);
|
2025-01-05 16:41:08 +00:00
|
|
|
browser_->setFactoryForManager(meshComponentManager->subModelFileProperyManager(), modelFileFactory);
|
2025-01-04 04:12:51 +00:00
|
|
|
componetManager_[meshComponentManager->GetPropertyId()] = meshComponentManager;
|
|
|
|
|
|
|
|
|
|
QtPathComponentManager* pathComponentManager = new QtPathComponentManager(this);
|
2025-01-04 16:11:29 +00:00
|
|
|
browser_->setFactoryForManager(pathComponentManager->subFilesProperyManager(), filePathFactory);
|
2025-01-04 04:12:51 +00:00
|
|
|
componetManager_[pathComponentManager->GetPropertyId()] = pathComponentManager;
|
|
|
|
|
|
|
|
|
|
QtConeWaveComponentManager* coneWaveComponentManager = new QtConeWaveComponentManager(this);
|
|
|
|
|
browser_->setFactoryForManager(coneWaveComponentManager->subDoubleProperyManager(), doubleSpinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(coneWaveComponentManager->subIntProperyManager(), spinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(coneWaveComponentManager->subColorProperyManager(), colorFactory);
|
|
|
|
|
componetManager_[coneWaveComponentManager->GetPropertyId()] = coneWaveComponentManager;
|
|
|
|
|
|
|
|
|
|
QtDashedLineComponentManager* dashedLineComponentManager = new QtDashedLineComponentManager(this);
|
|
|
|
|
browser_->setFactoryForManager(dashedLineComponentManager->subEntityProperyManager(), entityUUIDFactory);
|
|
|
|
|
browser_->setFactoryForManager(dashedLineComponentManager->subDoubleProperyManager(), doubleSpinBoxFactory);
|
|
|
|
|
browser_->setFactoryForManager(dashedLineComponentManager->subColorProperyManager(), colorFactory);
|
|
|
|
|
componetManager_[dashedLineComponentManager->GetPropertyId()] = dashedLineComponentManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBrowser::addProperty(QtProperty* property, const QString& id) {
|
|
|
|
|
propertyToId_[property] = id;
|
|
|
|
|
idToProperty_[id] = property;
|
|
|
|
|
QtBrowserItem* item = browser_->addProperty(property);
|
|
|
|
|
if (idToExpanded_.contains(id))
|
|
|
|
|
browser_->setExpanded(item, idToExpanded_[id]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtComponentPropertyManager* PropertyBrowser::GetCompononetPropertyManager(const QString& id) {
|
|
|
|
|
if (!componetManager_.contains(id)) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
return componetManager_[id];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertyBrowser::Test() {
|
|
|
|
|
QtProperty* property;
|
|
|
|
|
|
|
|
|
|
property = modelBaseManager_->addProperty(tr("ModelBase"));
|
2025-06-27 16:23:58 +00:00
|
|
|
QModelAttbute modelAttr(QString("test"), QString("test222"), true, 1.0 , true);
|
2025-01-04 04:12:51 +00:00
|
|
|
modelBaseManager_->setValue(property, modelAttr);
|
|
|
|
|
addProperty(property, QLatin1String("brush"));
|
|
|
|
|
|
|
|
|
|
property = colorManager_->addProperty(tr("color base"));
|
|
|
|
|
colorManager_->setValue(property, QColor(255, 12, 231, 252));
|
|
|
|
|
addProperty(property, QLatin1String("bda"));
|
2025-11-11 09:44:56 +00:00
|
|
|
}
|