2019-08-26 21:23:26 +08:00
|
|
|
#ifndef EXCUSTOMSTYLE_H
|
|
|
|
#define EXCUSTOMSTYLE_H
|
|
|
|
|
2019-09-10 22:36:14 +08:00
|
|
|
//Qt自带的库
|
2019-08-26 21:23:26 +08:00
|
|
|
#include <QCommonStyle>
|
2019-09-10 22:36:14 +08:00
|
|
|
#include <QPainter>
|
|
|
|
#include <QStyleOption>
|
2019-08-26 21:23:26 +08:00
|
|
|
|
2019-09-10 22:36:14 +08:00
|
|
|
//自定义的文件或库
|
2019-08-29 23:26:30 +08:00
|
|
|
#include "ExDefineGlobal.h"
|
|
|
|
|
|
|
|
CUSTOMSTYLE_BEDGIN_NAMESPACE
|
|
|
|
|
2019-09-10 22:36:14 +08:00
|
|
|
//一些工具函数:绘画圈,叉,对号,阴影等功能函数
|
|
|
|
CUSTOM_BEGIN_NAMESPACE
|
|
|
|
CUSTOMSTYLE_END_NAMESPACE
|
|
|
|
|
2019-08-26 21:23:26 +08:00
|
|
|
class ExCustomStyle : public QCommonStyle
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ExCustomStyle();
|
2019-09-10 22:36:14 +08:00
|
|
|
|
|
|
|
public: //重写QCommonStyle重载的函数
|
|
|
|
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const override;
|
|
|
|
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const override;
|
|
|
|
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget) const override;
|
|
|
|
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override;
|
|
|
|
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const override;
|
|
|
|
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const override;
|
|
|
|
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const override;
|
|
|
|
|
|
|
|
public:
|
2019-08-26 21:23:26 +08:00
|
|
|
};
|
|
|
|
|
2019-08-29 23:26:30 +08:00
|
|
|
CUSTOMSTYLE_END_NAMESPACE
|
|
|
|
|
2019-08-26 21:23:26 +08:00
|
|
|
#endif // EXCUSTOMSTYLE_H
|