27 lines
865 B
C++
27 lines
865 B
C++
#pragma once
|
|
/****************************
|
|
* 界面显隐处理器
|
|
* *************************/
|
|
#include "eventHandler.h"
|
|
|
|
class PanelVisibilityEventHandler : public EventHandler {
|
|
public:
|
|
bool canHandle(const QString& eventType) const override {
|
|
return eventType == "showPanel" || eventType == "hidePanel";
|
|
}
|
|
|
|
void handle(const EventData& event, GraphicsFunctionModelItem* item) override {
|
|
QString panelId = event.parameters.value("panelId").toString();
|
|
bool show = event.type == "showPanel";
|
|
if (event.parameters.contains("show")) {
|
|
show = event.parameters.value("show").toBool();
|
|
}
|
|
|
|
if (auto context = item->eventContext()) {
|
|
context->emitPanelVisibilityChanged(panelId, show);
|
|
}
|
|
}
|
|
|
|
QString handlerName() const override { return "PanelVisibilityHandler"; }
|
|
};
|