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(&Units::instance(), &Units::devicePixelRatioChanged, this, &FrameSvgItem::updateDevicePixelRatio);
|
||||||
connect(m_frameSvg, &Svg::fromCurrentThemeChanged, this, &FrameSvgItem::fromCurrentThemeChanged);
|
connect(m_frameSvg, &Svg::fromCurrentThemeChanged, this, &FrameSvgItem::fromCurrentThemeChanged);
|
||||||
connect(m_frameSvg, &Svg::statusChanged, this, &FrameSvgItem::statusChanged);
|
connect(m_frameSvg, &Svg::statusChanged, this, &FrameSvgItem::statusChanged);
|
||||||
|
connect(m_frameSvg, &Svg::sizeChanged, this, &FrameSvgItem::maskChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameSvgItem::~FrameSvgItem()
|
FrameSvgItem::~FrameSvgItem()
|
||||||
@ -455,6 +456,12 @@ bool FrameSvgItem::hasElementPrefix(const QString &prefix) const
|
|||||||
return m_frameSvg->hasElementPrefix(prefix);
|
return m_frameSvg->hasElementPrefix(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegion FrameSvgItem::mask() const
|
||||||
|
{
|
||||||
|
return m_frameSvg->mask();
|
||||||
|
}
|
||||||
|
|
||||||
void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
|
void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
|
||||||
const QRectF &oldGeometry)
|
const QRectF &oldGeometry)
|
||||||
{
|
{
|
||||||
|
@ -183,6 +183,12 @@ class FrameSvgItem : public QQuickItem
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(Plasma::Svg::Status status READ status WRITE setStatus NOTIFY statusChanged)
|
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:
|
public:
|
||||||
/**
|
/**
|
||||||
* @return true if the svg has the necessary elements with the given prefix
|
* @return true if the svg has the necessary elements with the given prefix
|
||||||
@ -220,6 +226,8 @@ public:
|
|||||||
void geometryChanged(const QRectF &newGeometry,
|
void geometryChanged(const QRectF &newGeometry,
|
||||||
const QRectF &oldGeometry) override;
|
const QRectF &oldGeometry) override;
|
||||||
|
|
||||||
|
QRegion mask() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only to be used from inside this library, is not intended to be invokable
|
* Only to be used from inside this library, is not intended to be invokable
|
||||||
*/
|
*/
|
||||||
@ -244,6 +252,7 @@ Q_SIGNALS:
|
|||||||
void repaintNeeded();
|
void repaintNeeded();
|
||||||
void statusChanged();
|
void statusChanged();
|
||||||
void usedPrefixChanged();
|
void usedPrefixChanged();
|
||||||
|
void maskChanged();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void doUpdate();
|
void doUpdate();
|
||||||
|
@ -241,13 +241,13 @@ void DialogPrivate::updateTheme()
|
|||||||
frameSvgItem->setImagePath(QStringLiteral("dialogs/background"));
|
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(),
|
KWindowEffects::enableBackgroundContrast(q->winId(), theme.backgroundContrastEnabled(),
|
||||||
theme.backgroundContrast(),
|
theme.backgroundContrast(),
|
||||||
theme.backgroundIntensity(),
|
theme.backgroundIntensity(),
|
||||||
theme.backgroundSaturation(),
|
theme.backgroundSaturation(),
|
||||||
frameSvgItem->frameSvg()->mask());
|
frameSvgItem->mask());
|
||||||
|
|
||||||
if (KWindowSystem::compositingActive()) {
|
if (KWindowSystem::compositingActive()) {
|
||||||
if (hasMask) {
|
if (hasMask) {
|
||||||
@ -256,7 +256,7 @@ void DialogPrivate::updateTheme()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hasMask = true;
|
hasMask = true;
|
||||||
q->setMask(frameSvgItem->frameSvg()->mask());
|
q->setMask(frameSvgItem->mask());
|
||||||
}
|
}
|
||||||
if (q->isVisible()) {
|
if (q->isVisible()) {
|
||||||
DialogShadows::self()->addWindow(q, frameSvgItem->enabledBorders());
|
DialogShadows::self()->addWindow(q, frameSvgItem->enabledBorders());
|
||||||
|
Loading…
Reference in New Issue
Block a user