FrameSvgItem: add "mask" property
Summary: This property allows e.g. the Plasma shell to query the shape a panel has when defining the area for BlurBehind. Reviewers: #plasma, mart Reviewed By: #plasma, mart Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20202
This commit is contained in:
parent
c72ee78bbb
commit
f20722fbe1
@ -272,6 +272,7 @@ FrameSvgItem::FrameSvgItem(QQuickItem *parent)
|
||||
connect(&Units::instance(), &Units::devicePixelRatioChanged, this, &FrameSvgItem::updateDevicePixelRatio);
|
||||
connect(m_frameSvg, &Svg::fromCurrentThemeChanged, this, &FrameSvgItem::fromCurrentThemeChanged);
|
||||
connect(m_frameSvg, &Svg::statusChanged, this, &FrameSvgItem::statusChanged);
|
||||
connect(m_frameSvg, &Svg::sizeChanged, this, &FrameSvgItem::maskChanged);
|
||||
}
|
||||
|
||||
FrameSvgItem::~FrameSvgItem()
|
||||
@ -455,6 +456,12 @@ bool FrameSvgItem::hasElementPrefix(const QString &prefix) const
|
||||
return m_frameSvg->hasElementPrefix(prefix);
|
||||
}
|
||||
|
||||
|
||||
QRegion FrameSvgItem::mask() const
|
||||
{
|
||||
return m_frameSvg->mask();
|
||||
}
|
||||
|
||||
void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry)
|
||||
{
|
||||
|
@ -183,6 +183,12 @@ class FrameSvgItem : public QQuickItem
|
||||
*/
|
||||
Q_PROPERTY(Plasma::Svg::Status status READ status WRITE setStatus NOTIFY statusChanged)
|
||||
|
||||
/**
|
||||
* The mask that tightly contains the painted areas
|
||||
* @since 5.58
|
||||
*/
|
||||
Q_PROPERTY(QRegion mask READ mask NOTIFY maskChanged)
|
||||
|
||||
public:
|
||||
/**
|
||||
* @return true if the svg has the necessary elements with the given prefix
|
||||
@ -220,6 +226,8 @@ public:
|
||||
void geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry) override;
|
||||
|
||||
QRegion mask() const;
|
||||
|
||||
/**
|
||||
* Only to be used from inside this library, is not intended to be invokable
|
||||
*/
|
||||
@ -244,6 +252,7 @@ Q_SIGNALS:
|
||||
void repaintNeeded();
|
||||
void statusChanged();
|
||||
void usedPrefixChanged();
|
||||
void maskChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void doUpdate();
|
||||
|
@ -241,13 +241,13 @@ void DialogPrivate::updateTheme()
|
||||
frameSvgItem->setImagePath(QStringLiteral("dialogs/background"));
|
||||
}
|
||||
|
||||
KWindowEffects::enableBlurBehind(q->winId(), theme.blurBehindEnabled(), frameSvgItem->frameSvg()->mask());
|
||||
KWindowEffects::enableBlurBehind(q->winId(), theme.blurBehindEnabled(), frameSvgItem->mask());
|
||||
|
||||
KWindowEffects::enableBackgroundContrast(q->winId(), theme.backgroundContrastEnabled(),
|
||||
theme.backgroundContrast(),
|
||||
theme.backgroundIntensity(),
|
||||
theme.backgroundSaturation(),
|
||||
frameSvgItem->frameSvg()->mask());
|
||||
frameSvgItem->mask());
|
||||
|
||||
if (KWindowSystem::compositingActive()) {
|
||||
if (hasMask) {
|
||||
@ -256,7 +256,7 @@ void DialogPrivate::updateTheme()
|
||||
}
|
||||
} else {
|
||||
hasMask = true;
|
||||
q->setMask(frameSvgItem->frameSvg()->mask());
|
||||
q->setMask(frameSvgItem->mask());
|
||||
}
|
||||
if (q->isVisible()) {
|
||||
DialogShadows::self()->addWindow(q, frameSvgItem->enabledBorders());
|
||||
|
Loading…
Reference in New Issue
Block a user