DecorationShadow uses QRect to set element sizes
This commit is contained in:
parent
1afc355759
commit
b337a0b52e
2 changed files with 7 additions and 32 deletions
|
@ -349,14 +349,7 @@ void Decoration::init()
|
|||
if (m_padding) {
|
||||
KDecoration2::DecorationShadow *s = new KDecoration2::DecorationShadow(this);
|
||||
s->setPadding(*m_padding);
|
||||
s->setTopLeft(QSize(m_padding->left(), m_padding->top()));
|
||||
s->setTopRight(QSize(m_padding->right(), m_padding->top()));
|
||||
s->setBottomLeft(QSize(m_padding->left(), m_padding->bottom()));
|
||||
s->setBottomRight(QSize(m_padding->right(), m_padding->bottom()));
|
||||
s->setLeft(QSize(m_padding->left(), 1));
|
||||
s->setRight(QSize(m_padding->right(), 1));
|
||||
s->setTop(QSize(1, m_padding->top()));
|
||||
s->setBottom(QSize(1, m_padding->bottom()));
|
||||
s->setInnerShadowRect(QRect(m_padding->left(), m_padding->top(), 1, 1));
|
||||
setShadow(s);
|
||||
}
|
||||
}
|
||||
|
@ -404,14 +397,10 @@ void Decoration::paint(QPainter *painter, const QRegion &repaintRegion)
|
|||
KDecoration2::DecorationShadow *s = new KDecoration2::DecorationShadow(this);
|
||||
s->setShadow(m_buffer);
|
||||
s->setPadding(*m_padding);
|
||||
s->setTopLeft(QSize(m_padding->left(), m_padding->top()));
|
||||
s->setTopRight(QSize(m_padding->right(), m_padding->top()));
|
||||
s->setBottomLeft(QSize(m_padding->left(), m_padding->bottom()));
|
||||
s->setBottomRight(QSize(m_padding->right(), m_padding->bottom()));
|
||||
s->setLeft(QSize(m_padding->left(), m_buffer.height() - m_padding->top() - m_padding->bottom()));
|
||||
s->setRight(QSize(m_padding->right(), m_buffer.height() - m_padding->top() - m_padding->bottom()));
|
||||
s->setTop(QSize(m_buffer.width() - m_padding->left() - m_padding->right(), m_padding->top()));
|
||||
s->setBottom(QSize(m_buffer.width() - m_padding->left() - m_padding->right(), m_padding->bottom()));
|
||||
s->setInnerShadowRect(QRect(m_padding->left(),
|
||||
m_padding->top(),
|
||||
m_buffer.width() - m_padding->left() - m_padding->right(),
|
||||
m_buffer.height() - m_padding->top() - m_padding->bottom()));
|
||||
auto oldShadow = shadow();
|
||||
setShadow(s);
|
||||
if (oldShadow) {
|
||||
|
|
18
shadow.cpp
18
shadow.cpp
|
@ -156,14 +156,7 @@ bool Shadow::init(KDecoration2::Decoration *decoration)
|
|||
{
|
||||
if (m_decorationShadow) {
|
||||
// disconnect previous connections
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::topLeftChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::topChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::topRightChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::rightChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomRightChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomLeftChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::leftChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::innerShadowRectChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::shadowChanged, m_topLevel, &Toplevel::getShadow);
|
||||
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingChanged, m_topLevel, &Toplevel::getShadow);
|
||||
}
|
||||
|
@ -172,14 +165,7 @@ bool Shadow::init(KDecoration2::Decoration *decoration)
|
|||
return false;
|
||||
}
|
||||
// setup connections - all just mapped to recreate
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::topLeftChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::topChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::topRightChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::rightChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomRightChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomLeftChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::leftChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::innerShadowRectChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::shadowChanged, m_topLevel, &Toplevel::getShadow);
|
||||
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingChanged, m_topLevel, &Toplevel::getShadow);
|
||||
|
||||
|
|
Loading…
Reference in a new issue