1 Star 0 Fork 0

uthelei/CodeLineCount

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
delegate.h 878 Bytes
一键复制 编辑 原始数据 按行查看 历史
lei.he 提交于 2021-04-23 17:47 . first commit
//界面样式处理,主界面的行高、可编辑列、圆角、颜色、可编辑列的代理
#ifndef DELEGATE_H
#define DELEGATE_H
#include <QStyledItemDelegate>
class HeightDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit HeightDelegate(QObject *parent = Q_NULLPTR);
~HeightDelegate() Q_DECL_OVERRIDE;
// 设置行高(默认 30)
void setHeight(int height);
// 缺省大小
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
// 自绘
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
// 初始样式选项
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const Q_DECL_OVERRIDE;
private:
int m_height = 36;
QColor m_color;
};
#endif // DELEGATE_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/uthelei/CodeLineCount.git
git@gitee.com:uthelei/CodeLineCount.git
uthelei
CodeLineCount
CodeLineCount
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385