123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #ifndef IDROPSHADOWABLE_H
- #define IDROPSHADOWABLE_H
- #include <QList>
- #include <QSize>
- #include <QColor>
- #include <QWidget>
- #include <QDebug>
- struct BoxShadow
- {
- int x;
- int y;
- int radius;
- int spread;
- QColor color;
- QSize boxSize;
- QImage image;
-
- bool operator==(const BoxShadow &rhs) const
- {
- return (this->radius == rhs.radius)
- &&(this->spread == rhs.spread)
- &&(this->color == rhs.color)
- &&(this->boxSize == rhs.boxSize);
- }
- bool operator<(const BoxShadow &rhs) const
- {
-
- if((this->radius == rhs.radius)
- &&(this->spread == rhs.spread)
- &&(this->color == rhs.color)
- &&(this->boxSize == rhs.boxSize))
- {
- return false;
- }
- else
- {
- return true;
- }
-
- }
- friend QDebug operator<<(QDebug debug, const BoxShadow &boxShadow)
- {
- debug << QString("(%1,%2)").arg(boxShadow.x).arg(boxShadow.y)
- <<boxShadow.color<<boxShadow.radius<<boxShadow.spread<<boxShadow.boxSize;
- return debug;
- }
- };
- Q_DECLARE_METATYPE(BoxShadow);
- class IDropShadowable
- {
- public:
- IDropShadowable(){}
- IDropShadowable(QWidget *selfWidget);
- protected:
- void SetDropShadow(const BoxShadow &boxShadow, const QSize &size);
- void SetDropShadows(const QList<BoxShadow> &shadows, const QSize &size);
- void ClearDropShadow();
- private:
- QWidget *m_pSelfWidget;
- QList<BoxShadow> m_listShadows;
- public:
- void PaintShadows();
- };
- #endif
|