#pragma once
|
|
#include <QWidget>
|
#include <QStandardItemModel>
|
#include <QHeaderView>
|
#include <QVector>
|
#include <QResizeEvent>
|
#include <QLabel>
|
#include <QPushButton>
|
#include <QString>
|
#include <QIcon>
|
#include <QDateTime>
|
#include <QHash>
|
|
namespace Ripples {
|
|
namespace Ui {class HistoryTask;}
|
|
class HistoryTask : public QWidget
|
{
|
Q_OBJECT
|
public:
|
explicit HistoryTask(QWidget *parent = nullptr);
|
~HistoryTask();
|
|
// 将表格宽度按比例进行划分
|
void autoResize(int totalWidth);
|
|
// 对外添加item的接口,暂定只传入项目名称和所在路径,创建时间可通过调用该函数直接获取
|
void addItem(const QString& name, const QString& path);
|
|
signals:
|
void previewSignal(int row, int column);
|
void copySignal(int row, int column);
|
void saveSignal(int row, int column);
|
void checkSignal(int row, int column);
|
|
private:
|
Ui::HistoryTask *ui;
|
// 重写resize事件,让QTableView能自适应缩放
|
void resizeEvent(QResizeEvent* event) override;
|
// 添加项目序号
|
void setProjectIndex(int row);
|
// 添加项目名称和所在路径
|
void setProjectNameAndPath(int row, const QString& name, const QString& path);
|
// 添加创建时间
|
void setCreateTime(int row, const QString& time);
|
// 在指定行中添加对应的5个功能按钮
|
void setFunctionIcon(int row);
|
// 删除tableView中的指定行
|
void deleteItem(int row, int column);
|
|
private:
|
// 每一列的宽度比例
|
QVector<int> m_weights;
|
QStandardItemModel* m_model;
|
|
// 存储索引与按钮之间的hash图
|
QHash<QModelIndex*, QWidget*> m_indexMapWithBtn;
|
|
bool m_lastModelItemFlag;
|
|
};
|
|
} // namespace Ripples
|