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.

153 lines
5.2 KiB
C

/**
*
* @file FITKTreeWidget.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*
*/
#ifndef _FITK_TREE_WIDGET_H___
#define _FITK_TREE_WIDGET_H___
#include "FITKWidgetAPI.h"
#include <QTreeWidget>
#include "FITK_Kernel/FITKCore/FITKAbstractGUIObject.h"
namespace Core
{
class FITKAbstractOperator;
}
namespace Comp
{
/**
* @brief 1
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
class FITKWidgetAPI FITKTreeWidget : public QTreeWidget, public Core::FITKAbstractGUIObject
{
Q_OBJECT
public:
/**
* @brief Construct a new FITKTreeWidget object
* @param[i] parent
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
explicit FITKTreeWidget(QWidget* parent = nullptr);
/**
* @brief Destroy the FITKTreeWidget object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
virtual ~FITKTreeWidget() = default;
/**
* @brief
* @param[i] parent
* @param[i] text
* @param[i] type
* @param[i] icon
* @param[i] state : -1使 0 1
* @return QTreeWidgetItem *
* @author liuzhonghua (liuzhonghuaszch@163.com)
* @date 2024-10-22
*/
static QTreeWidgetItem* CreateTreeRootItem(QTreeWidget* parent, const QString & text,
int type = 0, const QString& icon = "", int state = -1);
/**
* @brief
* @param[i] parent
* @param[i] text
* @param[i] type
* @param[i] icon
* @param[i] state : -1使 0 1
* @return QTreeWidgetItem*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
static QTreeWidgetItem* CreateTreeItem(QTreeWidgetItem* parent, const QString & text,
int type = 0, const QString& icon = "", int state = -1);
/**
* @brief
* @param[i] operName
* @return Core::FITKAbstractOperator*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
static Core::FITKAbstractOperator* GetOperator(const QString& operName);
template <class T>
/**
* @brief
* @param[i] operName
* @return T*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
T* getOperatorT(const QString & operName)
{
return dynamic_cast<T*> (this->GetOperator(operName));
}
protected:
/**
* @brief
* @param[i] item
* @param[i] column
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
virtual void on_itemClicked(QTreeWidgetItem *item, int column);
/**
* @brief
* @param[i] item
* @param[i] column
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
virtual void on_itemDoubleClicked(QTreeWidgetItem *item, int column);
/**
* @brief
* @param[i] item
* @param[i] state
* @param[i] column
* @return void
* @author liuzhonghua (liuzhonghuaszch@163.com)
* @date 2024-10-22
*/
virtual void on_itemStateChanged(QTreeWidgetItem *item, bool state, int column);
private slots:
/**
* @brief on_itemClicked
* @param[i] item
* @param[i] column
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
void slot_itemClicked(QTreeWidgetItem *item, int column);
/**
* @brief on_itemDoubleClicked
* @param[i] item
* @param[i] column
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-10-08
*/
void slot_itemDoubleClicked(QTreeWidgetItem *item, int column);
/**
* @brief on_itemStateChanged
* @param[i] item
* @param[i] column
* @return void
* @author liuzhonghua (liuzhonghuaszch@163.com)
* @date 2024-10-22
*/
void slot_itemStateChanged(QTreeWidgetItem *item, int column);
};
}
#endif