DecorationShadow elements are QRects

This commit is contained in:
Martin Gräßlin 2014-11-12 09:06:03 +01:00
parent b337a0b52e
commit f103cd0bea
2 changed files with 16 additions and 16 deletions

View file

@ -177,14 +177,14 @@ void PreviewItem::paintShadow(QPainter *painter, int &paddingLeft, int &paddingR
if (img.isNull()) {
return;
}
const QRect topLeft = QRect(QPoint(0, 0), shadow->topLeft());
const QRect top = QRect(QPoint(topLeft.width(), 0), shadow->top());
const QRect topRight = QRect(QPoint(topLeft.width() + top.width(), 0), shadow->topRight());
const QRect right = QRect(QPoint(topLeft.width() + top.width(), topRight.height()), shadow->right());
const QRect left = QRect(QPoint(0, topLeft.height()), shadow->left());
const QRect bottomLeft = QRect(QPoint(0, topLeft.height() + left.height()), shadow->bottomLeft());
const QRect bottom = QRect(QPoint(bottomLeft.width(), img.height() - shadow->bottom().height()), shadow->bottom());
const QRect bottomRight = QRect(QPoint(bottomLeft.width() + bottom.width(), topRight.height() + right.height()), shadow->bottomRight());
const QRect &topLeft = shadow->topLeftGeometry();
const QRect &top = shadow->topGeometry();
const QRect &topRight = shadow->topRightGeometry();
const QRect &right = shadow->rightGeometry();
const QRect &left = shadow->leftGeometry();
const QRect &bottomLeft = shadow->bottomLeftGeometry();
const QRect &bottom = shadow->bottomGeometry();
const QRect &bottomRight = shadow->bottomRightGeometry();
painter->translate(paddingLeft, paddingTop);

View file

@ -333,21 +333,21 @@ QSize Shadow::elementSize(Shadow::ShadowElements element) const
if (m_decorationShadow) {
switch (element) {
case ShadowElementTop:
return m_decorationShadow->top();
return m_decorationShadow->topGeometry().size();
case ShadowElementTopRight:
return m_decorationShadow->topRight();
return m_decorationShadow->topRightGeometry().size();
case ShadowElementRight:
return m_decorationShadow->right();
return m_decorationShadow->rightGeometry().size();
case ShadowElementBottomRight:
return m_decorationShadow->bottomRight();
return m_decorationShadow->bottomRightGeometry().size();
case ShadowElementBottom:
return m_decorationShadow->bottom();
return m_decorationShadow->bottomGeometry().size();
case ShadowElementBottomLeft:
return m_decorationShadow->bottomLeft();
return m_decorationShadow->bottomLeftGeometry().size();
case ShadowElementLeft:
return m_decorationShadow->left();
return m_decorationShadow->leftGeometry().size();
case ShadowElementTopLeft:
return m_decorationShadow->topLeft();
return m_decorationShadow->topLeftGeometry().size();
default:
return QSize();
}