Multiple improvements
@ -1,81 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021 Rui Wang <wangrui@jingos.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License or (at your option) version 3 or any later version
|
||||
* accepted by the membership of KDE e.V. (or its successor approved
|
||||
* by the membership of KDE e.V.), which shall act as a proxy
|
||||
* defined in Section 14 of version 3 of the license.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Item {
|
||||
id: blurBackground
|
||||
|
||||
property QtObject sourceItem: null
|
||||
|
||||
property real blurRadius: 0
|
||||
property real radius: 0
|
||||
property color backgroundColor
|
||||
|
||||
property int startX: 0
|
||||
property int startY: 0
|
||||
|
||||
ShaderEffectSource {
|
||||
id:eff
|
||||
anchors.fill: parent
|
||||
sourceItem: blurBackground.sourceItem
|
||||
sourceRect: Qt.rect(blurBackground.startX,blurBackground.startY,blurBackground.width,blurBackground.height)
|
||||
visible: false
|
||||
}
|
||||
|
||||
onStartXChanged: {
|
||||
var jx = eff.mapToItem(blurBackground.sourceItem, blurBackground.x, blurBackground.y)
|
||||
blurBackground.startX = jx.x
|
||||
blurBackground.startY = jx.y
|
||||
eff.sourceRect = Qt.rect(blurBackground.startX,blurBackground.startY,blurBackground.width,blurBackground.height)
|
||||
}
|
||||
|
||||
FastBlur {
|
||||
id:fastBlur
|
||||
anchors.fill: parent
|
||||
source: eff
|
||||
radius: blurBackground.blurRadius
|
||||
cached: true
|
||||
visible: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: maskRect
|
||||
anchors.fill: parent
|
||||
color: blurBackground.backgroundColor
|
||||
radius: blurBackground.radius
|
||||
visible: false
|
||||
}
|
||||
|
||||
OpacityMask {
|
||||
id:mask
|
||||
anchors.fill: maskRect
|
||||
source: fastBlur
|
||||
maskSource: maskRect
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: blurBackground.backgroundColor
|
||||
radius: blurBackground.radius
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12 as QQC2
|
||||
import QtGraphicalEffects 1.0
|
||||
import MeuiKit 1.0 as Meui
|
||||
|
||||
QQC2.Menu {
|
||||
id: control
|
||||
|
||||
property real blurRadius: 100
|
||||
// property alias blurRadius: bkground.blurRadius
|
||||
property alias backgroundOpacity: _menubg.backgroundOpacity
|
||||
property real backgroundRadius: Meui.Theme.smallRadius
|
||||
|
||||
background: Meui.RoundedRect {
|
||||
id: _menubg
|
||||
backgroundOpacity: 0.7
|
||||
radius: control.backgroundRadius
|
||||
blurEnabled: true
|
||||
sourceItem: control.parent
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
radius: 32
|
||||
samples: 32
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
color: Qt.rgba(0, 0, 0, 0.11)
|
||||
}
|
||||
}
|
||||
|
||||
// background: Meui.BlurBackground {
|
||||
// id: bkground
|
||||
// sourceItem: control.parent
|
||||
// backgroundColor: "transparent"
|
||||
// startX: control.x
|
||||
// startY: control.y
|
||||
// blurRadius: 144
|
||||
// radius: control.backgroundRadius
|
||||
|
||||
// Meui.RoundedRect {
|
||||
// id: roundedRect
|
||||
// anchors.fill: parent
|
||||
// backgroundOpacity: 0.7
|
||||
// radius: control.backgroundRadius
|
||||
// }
|
||||
|
||||
// layer.enabled: true
|
||||
// layer.effect: DropShadow {
|
||||
// transparentBorder: true
|
||||
// radius: 32
|
||||
// samples: 32
|
||||
// horizontalOffset: 0
|
||||
// verticalOffset: 0
|
||||
// color: Qt.rgba(0, 0, 0, 0.11)
|
||||
// }
|
||||
// }
|
||||
|
||||
// onVisibleChanged: {
|
||||
// var jx = contentItem.mapToItem(control.parent, control.x, control.y)
|
||||
// bkground.startX = jx.x
|
||||
// bkground.startY = jx.y
|
||||
// }
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.2 KiB |