27 lines
620 B
C++
27 lines
620 B
C++
#pragma once
|
|
#include <QtGui>
|
|
#include <QHeaderView>
|
|
#include <QStyleOptionButton>
|
|
#include <QStyle>
|
|
|
|
// 参考 https://blog.csdn.net/wj584652425/article/details/125034684
|
|
|
|
|
|
class CheckBoxHeaderView : public QHeaderView
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CheckBoxHeaderView(int checkColumnIndex, Qt::Orientation orientation, QWidget* parent = 0);
|
|
void setCheckStaus(bool isChecked);
|
|
bool getCheckStaus();
|
|
signals:
|
|
void checkStausChange(bool);
|
|
|
|
protected:
|
|
void paintSection(QPainter* painter, const QRect& rect, int logicalIndex) const;
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
private:
|
|
bool m_isChecked;
|
|
int m_checkColIdx;
|
|
}; |