1234567891011121314151617181920212223242526272829303132 |
- #ifndef ONESHADOW_H
- #define ONESHADOW_H
- #include <QSize>
- #include <QColor>
- #include <QImage>
- /**
- * OneShadow的用法,把这个类放到需要显示阴影的控件下面
- * 也就是他的父类上,在父类的paintEvent()函数里绘制image
- *
- * QPainter painter(this);
- * painter.setRenderHint(QPainter::Antialiasing);
- * painter.drawImage(QPoint(0,0),m_shadow->image());
- */
- class OneShadow
- {
- public:
- OneShadow(QSize contentSize,int radius = 5,QColor shadowColor = QColor(0, 0, 0, 60));
- ~OneShadow();
- QImage& image();
- private:
- // int radius; /* 阴影的宽度 */
- // QSize contentSize; /* 阴影上面内容的大小 */
- // QColor shadowColor; /* 颜色 */
- QImage* m_image = nullptr;
- };
- #endif // ONESHADOW_H
|