Files
spark-store/src/appdelegate.h
2025-06-08 10:44:51 +08:00

32 lines
965 B
C++

#ifndef APPDELEGATE_H
#define APPDELEGATE_H
#include <QStyledItemDelegate>
#include <QPainter>
#include <QEvent>
#include <QMouseEvent>
// 前向声明 DownloadManager 类
class DownloadManager;
class AppDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit AppDelegate(QObject *parent = nullptr);
// 重写方法
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
signals:
void updateDisplay(); // 声明更新显示的信号
private:
DownloadManager *m_downloadManager; // 声明下载管理器指针
int m_progress = 0; // 声明下载进度
bool m_isDownloading = false; // 声明下载状态
};
#endif // APPDELEGATE_H