You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/OperatorsModel/OperManagerBase.cpp

58 lines
1.8 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "OperManagerBase.h"
#include "GUIFrame/MainWindow.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Kernel/FITKCore/FITKAbstractNDataObject.h"
namespace ModelOper
{
/**
* @brief OperManagerBase的构造函数
*
* 该构造函数初始化OperManagerBase类的一个实例。它通过动态类型转换从FITKAPP的全局数据中获取GUI::MainWindow的指针并将其赋值给_mainWindow成员变量。
*
* @param args 构造函数参数列表(当前未列出具体参数,表示可能有可选的参数传递给构造函数)
*/
OperManagerBase::OperManagerBase(/* args */)
{
_mainWindow = dynamic_cast<GUI::MainWindow *>(FITKAPP->getGlobalData()->getMainWindow());
}
/**
* @brief OperManagerBase的析构函数
*
* 该析构函数释放OperManagerBase类实例的资源是一个空函数体。
*/
OperManagerBase::~OperManagerBase()
{
}
void OperManagerBase::preArgs()
{
if (_emitter == nullptr)return;
auto current = _emitter;
_senderName = current->objectName();
QString name = _senderName.toLower();
// 根据对象名称后缀确定操作类型
if (name.contains("create")) {
_operType = Create;
}
else if (name.contains("edit")) {
_operType = Edit;
}
else if (name.contains("rename")){
_operType = Rename;
}
else if (name.contains("copy")){
_operType = Copy;
}
else if (name.contains("delete")){
_operType = Delete;
}
else if (name.contains("select")) {
_operType = Select;
}
}
} // namespace ModelOper