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.

182 lines
5.5 KiB
C

/**
* @file FITKTableWidget.h
* @brief
* @author YanZhiHui(chanyuantiandao@126.com)
* @date 2024-10-21
*/
#ifndef FITKTableWidget_H_
#define FITKTableWidget_H_
#include <QTableWidget>
#include <QClipboard>
#include <QModelIndex>
#include "FITKWidgetAPI.h"
namespace Comp
{
/**
* @brief
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
class FITKWidgetAPI FITKTableWidget : public QTableWidget
{
Q_OBJECT
public:
/**
* @brief
* @param parent
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
explicit FITKTableWidget(QWidget *parent = nullptr);
/**
* @brief
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
~FITKTableWidget();
/**
* @brief
* @param b
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
void setAppendLineByEnterPressed(bool b);
/**
* @brief false
* @param[i] isAlone true false
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-07
*/
void setIsAloneRow(bool isAlone);
/**
* @brief
* @param[in] rowNum
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-08-14
*/
void addTableRowAndItem(int rowNum);
signals:
/**
* @brief
* @param index
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
void cellEnterPressed(QModelIndex index);
public slots:
/**
* @brief
* @param[in]
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void customContextMenuRequestedSlot(QPoint);
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void cutActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void copyActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void pasteActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void insertBeforeActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void insertAfterActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void deleteRowActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void clearContentsActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void clearTableActionSlot();
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-07-26
*/
void readFileActionSlot();
protected:
/**
* @brief
* @param event
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
virtual void keyPressEvent(QKeyEvent *event) override;
/**
* @brief
* @param event
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
virtual void keyReleaseEvent(QKeyEvent *event) override;
/**
* @brief
* @author YanZhiHui (chanyuantiandao@126.com)
* @data 2024-05-14
*/
bool edit(const QModelIndex &index, EditTrigger trigger = QAbstractItemView::SelectedClicked, QEvent *event = nullptr) override;
private:
/**
* @brief
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-04-22
*/
bool _isAppendLineByEnterPressed{ false };
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-08-14
*/
QMenu *_tableWidgetContextMenu{};
/**
* @brief
* @author yanzhihui (chanyuantiandao@126.com)
* @date 2023-08-14
*/
QClipboard *_clipboard{};
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-04-22
*/
bool _isAloneRow = false;
};
}
#endif