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/FITK_Component/FITKWidget/FITKTableWidget.h

160 lines
4.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.

/**
*
* @file FITKTableWidget.h
* @brief 表格组件添加
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*
*/
#ifndef FITKTableWidget_H_
#define FITKTableWidget_H_
#include <QTableWidget>
#include "FITKWidgetAPI.h"
namespace Comp
{
/**
* @brief 表格组件添加
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
class FITKWidgetAPI FITKTableWidget :public QTableWidget
{
Q_OBJECT;
public:
/**
* @brief Construct a new FITKTableWidget object
* @param[i] parent My Param doc
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
FITKTableWidget(QWidget* parent);
/**
* @brief Destroy the FITKTableWidget object
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual ~FITKTableWidget();
/**
* @brief 设置回车按钮是否添加一行默认为true
* @param[i] isAppend true开启 false关闭
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
void setAppendLineByEnterPressed(bool isAppend);
/**
* @brief 设置表格是否是单行模式默认为false
* @param[i] isAlone true开启 false关闭
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
void setIsAloneRow(bool isAlone);
protected slots:
;
/**
* @brief 剪切当前数据
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void cutCurrentData();
/**
* @brief 拷贝当前数据
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void copyCurrentData();
/**
* @brief 粘贴
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void pasteCurrentData();
/**
* @brief 在当前行前面插入一行空白数据
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void insertRowBefore();
/**
* @brief 在当前行后面插入一行空白数据
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void insertRowAfter();
/**
* @brief 删除一行或多行数据
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void deleteTableRows();
/**
* @brief 删除一个单元格的数据
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void clearContents();
/**
* @brief 清空所有tableWidget的数据保留空行
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void clearTable();
/**
* @brief 上下文菜单事件处理
* @param[i] pos My Param doc
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void handleContextMenu(const QPoint& pos);
protected:
/**
* @brief 键盘按下事件重写(重写换行按钮事件)
* @param[i] event 事件对象
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void keyPressEvent(QKeyEvent *event) override;
/**
* @brief 键盘抬起事件重写
* @param[i] event 事件对象
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void keyReleaseEvent(QKeyEvent *event) override;
/**
* @brief 重写方法,屏蔽编辑框的右键菜单
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual bool edit(const QModelIndex &index, EditTrigger trigger = QAbstractItemView::SelectedClicked, QEvent *event = nullptr) override;
/**
* @brief 插入新行
* @param[i] row 所要插入的行号
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
virtual void insertNewRow(int row);
protected:
/**
* @brief 拷贝数据
* @author BaGuijun (baguijun@163.com)
* @date 2024-04-22
*/
QString _copyValue = "";
/**
* @brief 是否通过回车添加换行标记符
* @author BaGuijun (baguijun@163.com)
* @date 2024-04-22
*/
bool _isAddLineByEnter = true;
/**
* @brief 是否为单行模式标记符
* @author BaGuijun (baguijun@163.com)
* @date 2024-04-22
*/
bool _isAloneRow = false;
};
}
#endif