This commit is contained in:
codeboss 2025-07-06 10:26:24 +08:00
parent 0187d1bd9f
commit f329cfa7dc
6 changed files with 66 additions and 40 deletions

View File

@ -477,7 +477,9 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/)
_message_panel(new QTabWidget(this)), _message_panel(new QTabWidget(this)),
_stacked_panel(new QStackedWidget(this)), _stacked_panel(new QStackedWidget(this)),
_logs_present(new QTextBrowser(this)), _logs_present(new QTextBrowser(this)),
_map_configuration(new BehaviorMapConfigurationPanel(this)) _map_configuration(new BehaviorMapConfigurationPanel(this)),
_compare_configuration(new CompareNodeConfiguration(this)),
_default_configuration(new QLabel(u8"该节点无需配置", this))
{ {
_global_loader = std::make_shared<MessageLoader>(); _global_loader = std::make_shared<MessageLoader>();
_global_kernal = std::make_shared<MapKernel>(_global_loader); _global_kernal = std::make_shared<MapKernel>(_global_loader);
@ -510,16 +512,17 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/)
_type_view->setModel(_type_model); _type_view->setModel(_type_model);
nodeTypesViewInit(_type_model); nodeTypesViewInit(_type_model);
_default_configuration->setFrameStyle(QFrame::WinPanel|QFrame::Sunken);
_default_configuration->setAlignment(Qt::AlignCenter);
// 下方堆叠面板 // 下方堆叠面板
_message_panel->addTab(_logs_present, u8"控制台"); _message_panel->addTab(_logs_present, u8"控制台");
_message_panel->addTab(_stacked_panel, u8"属性配置"); _message_panel->addTab(_stacked_panel, u8"属性配置");
_stacked_panel->addWidget(new BehaviorMapConfigurationPanel(this)); _stacked_panel->addWidget(_compare_configuration);
_stacked_panel->addWidget(newModifyNodeConfigration(this)); _stacked_panel->addWidget(newModifyNodeConfigration(this));
_stacked_panel->addWidget(newActionNodeConfigration(this)); _stacked_panel->addWidget(newActionNodeConfigration(this));
_stacked_panel->addWidget(newCompareNodeConfigration(this)); _stacked_panel->addWidget(_map_configuration);
_stacked_panel->addWidget(newDefaultConfigration(this)); _stacked_panel->addWidget(_default_configuration);
} }
void BehaviorEditor::nodeTypesViewInit(QStandardItemModel* m) void BehaviorEditor::nodeTypesViewInit(QStandardItemModel* m)
@ -539,33 +542,6 @@ void BehaviorEditor::nodeTypesViewInit(QStandardItemModel* m)
#include <QComboBox> #include <QComboBox>
#include <QPushButton> #include <QPushButton>
QWidget* BehaviorEditor::newDefaultConfigration(QWidget* pwidget)
{
auto ins = new QLabel(u8"该结点无需配置", pwidget);
ins->setAlignment(Qt::AlignCenter);
ins->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
return ins;
}
QWidget* BehaviorEditor::newCompareNodeConfigration(QWidget* pwidget)
{
auto panel = new QFrame(this);
panel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
auto p_layout = new QGridLayout(panel);
auto compare_types = new QComboBox(this);
p_layout->addWidget(new QLabel(u8"类型筛选:", this), 0, 0);
p_layout->addWidget(new QComboBox(this), 0, 1, 1, 5);
p_layout->addWidget(new QLabel(u8"比较器类型:"), 1, 0);
p_layout->addWidget(compare_types, 1, 1, 1, 5);
p_layout->addWidget(new QLabel(u8"输入变量A", this), 2, 0);
p_layout->addWidget(new QComboBox(this), 2, 1, 1, 5);
p_layout->addWidget(new QLabel(u8"输入变量B", this), 3, 0);
p_layout->addWidget(new QComboBox(this), 3, 1, 1, 5);
p_layout->setColumnStretch(1, 1);
return panel;
}
QWidget* BehaviorEditor::newActionNodeConfigration(QWidget* pwidget) QWidget* BehaviorEditor::newActionNodeConfigration(QWidget* pwidget)
{ {

View File

@ -147,8 +147,9 @@ protected:
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QTableView> #include <QTableView>
#include <QStackedWidget> #include <QStackedWidget>
#include <QLabel>
#include "BehaviorConfigurationPanel.h" #include "BehaviorConfigurationPanel.h"
#include "CompareNodeConfiguration.h"
/// <summary> /// <summary>
/// ÐÐΪÊ÷½Úµã±à¼­Æ÷ /// ÐÐΪÊ÷½Úµã±à¼­Æ÷
@ -164,6 +165,8 @@ private:
QTabWidget *const _message_panel; QTabWidget *const _message_panel;
QStackedWidget *const _stacked_panel; QStackedWidget *const _stacked_panel;
BehaviorMapConfigurationPanel *const _map_configuration; BehaviorMapConfigurationPanel *const _map_configuration;
CompareNodeConfiguration *const _compare_configuration;
QLabel *const _default_configuration;
std::shared_ptr<BehaviorMapNode> _map_root; std::shared_ptr<BehaviorMapNode> _map_root;
QUrl _current_fileurl; QUrl _current_fileurl;
@ -176,19 +179,13 @@ private:
// ============================================== // ==============================================
QTextBrowser* const _logs_present; QTextBrowser* const _logs_present;
// ==============================================
// ==============================================
QWidget* newDefaultConfigration(QWidget* pwidget);
// ==============================================
QWidget* newCompareNodeConfigration(QWidget* pwidget);
// ============================================== // ==============================================
QWidget* newActionNodeConfigration(QWidget* pwidget); QWidget* newActionNodeConfigration(QWidget* pwidget);
// ============================================== // ==============================================
QWidget* newModifyNodeConfigration(QWidget* pwidget); QWidget* newModifyNodeConfigration(QWidget* pwidget);
public: public:
BehaviorEditor(QWidget* parent = nullptr); BehaviorEditor(QWidget* parent = nullptr);

View File

@ -0,0 +1,28 @@
#include "CompareNodeConfiguration.h"
#include <QGridLayout>
#include <QLabel>
CompareNodeConfiguration::CompareNodeConfiguration(QWidget* p)
: QFrame(p),
_type_select(new QComboBox(this)),
_compare_select(new QComboBox(this)),
_variable_a(new QComboBox(this)),
_variable_b(new QComboBox(this))
{
this->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
auto p_layout = new QGridLayout(this);
p_layout->addWidget(new QLabel(u8"类型筛选:", this), 0, 0);
p_layout->addWidget(_type_select, 0, 1, 1, 5);
p_layout->addWidget(new QLabel(u8"比较器类型:"), 1, 0);
p_layout->addWidget(_compare_select, 1, 1, 1, 5);
p_layout->addWidget(new QLabel(u8"输入变量A", this), 2, 0);
p_layout->addWidget(_variable_a, 2, 1, 1, 5);
p_layout->addWidget(new QLabel(u8"输入变量B", this), 3, 0);
p_layout->addWidget(_variable_b, 3, 1, 1, 5);
p_layout->addWidget(new QWidget(this), 4, 0, 1, 6);
p_layout->setColumnStretch(1, 1);
p_layout->setRowStretch(4, 1);
}

View File

@ -0,0 +1,17 @@
#pragma once
#include <QFrame>
#include <QComboBox>
class CompareNodeConfiguration : public QFrame
{
private:
QComboBox *const _type_select;
QComboBox *const _compare_select;
QComboBox *const _variable_a;
QComboBox *const _variable_b;
public:
CompareNodeConfiguration(QWidget *p = nullptr);
};

View File

@ -101,6 +101,7 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="BehaviorConfigurationPanel.cpp" /> <ClCompile Include="BehaviorConfigurationPanel.cpp" />
<ClCompile Include="BehaviorEditor.cpp" /> <ClCompile Include="BehaviorEditor.cpp" />
<ClCompile Include="CompareNodeConfiguration.cpp" />
<ClCompile Include="PerspectiveView.cpp" /> <ClCompile Include="PerspectiveView.cpp" />
<ClCompile Include="TempletAssemble.cpp" /> <ClCompile Include="TempletAssemble.cpp" />
<QtRcc Include="sims_world.qrc" /> <QtRcc Include="sims_world.qrc" />
@ -118,6 +119,7 @@
<QtMoc Include="PerspectiveView.h" /> <QtMoc Include="PerspectiveView.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="CompareNodeConfiguration.h" />
<QtMoc Include="BehaviorConfigurationPanel.h" /> <QtMoc Include="BehaviorConfigurationPanel.h" />
<ClInclude Include="BehaviorEditor.h" /> <ClInclude Include="BehaviorEditor.h" />
</ItemGroup> </ItemGroup>

View File

@ -58,6 +58,9 @@
<ClCompile Include="BehaviorConfigurationPanel.cpp"> <ClCompile Include="BehaviorConfigurationPanel.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="CompareNodeConfiguration.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="TempletAssemble.h"> <QtMoc Include="TempletAssemble.h">
@ -74,5 +77,8 @@
<ClInclude Include="BehaviorEditor.h"> <ClInclude Include="BehaviorEditor.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CompareNodeConfiguration.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>