6#include "decorationshadow.h"
7#include "decorationshadow_p.h"
11DecorationShadow::Private::Private(DecorationShadow *parent)
16DecorationShadow::Private::~Private() =
default;
18DecorationShadow::DecorationShadow()
20 , d(new Private(this))
24DecorationShadow::~DecorationShadow() =
default;
26QRect DecorationShadow::topLeftGeometry()
const
28 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
31 return QRect(0, 0, d->innerShadowRect.left(), d->innerShadowRect.top());
34QRect DecorationShadow::topGeometry()
const
36 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
39 return QRect(d->innerShadowRect.left(), 0, d->innerShadowRect.width(), d->innerShadowRect.top());
42QRect DecorationShadow::topRightGeometry()
const
44 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
47 return QRect(d->innerShadowRect.left() + d->innerShadowRect.width(),
49 d->shadow.width() - d->innerShadowRect.width() - d->innerShadowRect.left(),
50 d->innerShadowRect.top());
53QRect DecorationShadow::rightGeometry()
const
55 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
58 return QRect(d->innerShadowRect.left() + d->innerShadowRect.width(),
59 d->innerShadowRect.top(),
60 d->shadow.width() - d->innerShadowRect.width() - d->innerShadowRect.left(),
61 d->innerShadowRect.height());
64QRect DecorationShadow::bottomRightGeometry()
const
66 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
69 return QRect(d->innerShadowRect.left() + d->innerShadowRect.width(),
70 d->innerShadowRect.top() + d->innerShadowRect.height(),
71 d->shadow.width() - d->innerShadowRect.width() - d->innerShadowRect.left(),
72 d->shadow.height() - d->innerShadowRect.top() - d->innerShadowRect.height());
75QRect DecorationShadow::bottomGeometry()
const
77 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
80 return QRect(d->innerShadowRect.left(),
81 d->innerShadowRect.top() + d->innerShadowRect.height(),
82 d->innerShadowRect.width(),
83 d->shadow.height() - d->innerShadowRect.top() - d->innerShadowRect.height());
86QRect DecorationShadow::bottomLeftGeometry()
const
88 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
92 d->innerShadowRect.top() + d->innerShadowRect.height(),
93 d->innerShadowRect.left(),
94 d->shadow.height() - d->innerShadowRect.top() - d->innerShadowRect.height());
97QRect DecorationShadow::leftGeometry()
const
99 if (d->innerShadowRect.isNull() || d->shadow.isNull()) {
102 return QRect(0, d->innerShadowRect.top(), d->innerShadowRect.left(), d->innerShadowRect.height());
107QImage DecorationShadow::shadow()
const
112QMargins DecorationShadow::padding()
const
117QRect DecorationShadow::innerShadowRect()
const
119 return d->innerShadowRect;
122int DecorationShadow::paddingTop()
const
124 return d->padding.
top();
127int DecorationShadow::paddingBottom()
const
129 return d->padding.bottom();
132int DecorationShadow::paddingRight()
const
134 return d->padding.right();
137int DecorationShadow::paddingLeft()
const
139 return d->padding.left();
142void DecorationShadow::setShadow(
const QImage &shadow)
144 if (d->shadow == shadow) {
148 Q_EMIT shadowChanged(d->shadow);
153void DecorationShadow::setPadding(
const QMargins &margins)
155 if (d->padding == margins) {
158 d->padding = margins;
159 Q_EMIT paddingChanged();
162void DecorationShadow::setInnerShadowRect(
const QRect &rect)
164 if (d->innerShadowRect == rect) {
167 d->innerShadowRect = rect;
168 Q_EMIT innerShadowRectChanged();
173#include "moc_decorationshadow.cpp"
Framework for creating window decorations.