diff --git a/package/contents/ui/components/FormWidgetSettings.qml b/package/contents/ui/components/FormWidgetSettings.qml index 9eb0439..ea3c536 100644 --- a/package/contents/ui/components/FormWidgetSettings.qml +++ b/package/contents/ui/components/FormWidgetSettings.qml @@ -80,6 +80,7 @@ ColumnLayout { } } RowLayout { + visible: keyName !== "" Label { text: i18n("Blur behind:") } diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index d98eab9..c499d9c 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -830,18 +830,22 @@ PlasmoidItem { } onXChanged: { + position = Utils.getGlobalPosition(borderRec, panelElement) updateMask() } onYChanged: { + position = Utils.getGlobalPosition(borderRec, panelElement) updateMask() } onWidthChanged: { + position = Utils.getGlobalPosition(borderRec, panelElement) updateMask() } onHeightChanged: { + position = Utils.getGlobalPosition(borderRec, panelElement) updateMask() } @@ -867,17 +871,21 @@ PlasmoidItem { // TODO find where does 16 and 8 come from instead of blindly hardcoding them property real moveX: { - let m = horizontal ? 0 : (panelState.floating ? 16 : 0) + let m = horizontal ? 0 : (panelElement?.floating && plasmoid.location === PlasmaCore.Types.LeftEdge ? 16 : 0) return floatigness > 0 ? 8 : m } property real moveY: { - let m = horizontal ? (panelState.floating ? 16 : 0) : 0 + let m = horizontal ? (panelElement?.floating && plasmoid.location === PlasmaCore.Types.TopEdge ? 16 : 0) : 0 return floatigness > 0 ? 8 : m } + onVisibleChanged: { + updateMask() + } + function updateMask() { - Qt.callLater(function() { + // Qt.callLater(function() { if (panelColorizer === null || !blurBehind) return panelColorizer.updatePanelMask( maskIndex, @@ -887,9 +895,10 @@ PlasmoidItem { rect.corners.bottomLeftRadius, rect.corners.bottomRightRadius, Qt.point(rect.positionX-moveX, rect.positionY-moveY), - 5 + 5, + visible ) - }) + // }) } } diff --git a/plugin/panelcolorizer.cpp b/plugin/panelcolorizer.cpp index 04694c6..ec6dcde 100644 --- a/plugin/panelcolorizer.cpp +++ b/plugin/panelcolorizer.cpp @@ -17,7 +17,7 @@ PanelColorizer::PanelColorizer(QObject *parent) : QObject(parent) {} void PanelColorizer::updatePanelMask(int index, QRectF rect, double topLeftRadius, double topRightRadius, double bottomLeftRadius, double bottomRightRadius, QPointF offset, - int radiusCompensation) { + int radiusCompensation, bool visible) { // qDebug() << "updatePanelMask x:" << offset.x() << " y:" << offset.y() << " W:" << rect.width() // << " H:" << rect.height(); topLeftRadius += (topLeftRadius != 0) ? radiusCompensation : 0; @@ -50,11 +50,7 @@ void PanelColorizer::updatePanelMask(int index, QRectF rect, double topLeftRadiu double translateY = abs(offset.y()); region.translate(translateX, translateY); - if (index >= m_regions.size()) { - m_regions.resize(index + 1); - } - - m_regions[index] = region; + m_regions[index] = qMakePair(region, visible); combineRegions(); } @@ -62,8 +58,10 @@ QVariant PanelColorizer::mask() const { return QVariant::fromValue(m_mask); } void PanelColorizer::combineRegions() { QRegion combined; - for (const QRegion ®ion : m_regions) { - combined = combined.united(region); + for (const auto &pair : m_regions) { + if (pair.second) { + combined = combined.united(pair.first); + } } bool hadRegions = hasRegions(); diff --git a/plugin/panelcolorizer.h b/plugin/panelcolorizer.h index 2792a6e..af28064 100644 --- a/plugin/panelcolorizer.h +++ b/plugin/panelcolorizer.h @@ -16,7 +16,7 @@ class PanelColorizer : public QObject { public: Q_INVOKABLE void updatePanelMask(int index, QRectF rect, double topLeftRadius, double topRightRadius, double bottomLeftRadius, double bottomRightRadius, QPointF offset, - int radiusCompensation); + int radiusCompensation, bool visible); explicit PanelColorizer(QObject *parent = nullptr); @@ -30,7 +30,8 @@ class PanelColorizer : public QObject { private: QString m_time; qreal m_value; - QVector m_regions; + // QVector m_regions; + QMap> m_regions; QRegion m_mask; void combineRegions(); };