Fix ripple and hover effekt for tiles and delegates with round corners
This commit is contained in:
parent
37b08fb84b
commit
c6e8e7aa06
@ -53,6 +53,7 @@ BigTile {
|
|||||||
text: root.thing.name
|
text: root.thing.name
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
ThingStatusIcons {
|
ThingStatusIcons {
|
||||||
thing: root.thing
|
thing: root.thing
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.Material
|
import QtQuick.Controls.Material
|
||||||
|
import QtQuick.Controls.Material.impl
|
||||||
|
|
||||||
import Nymea
|
import Nymea
|
||||||
|
|
||||||
@ -101,6 +102,16 @@ Item {
|
|||||||
: Style.tileBackgroundColor
|
: Style.tileBackgroundColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ripple {
|
||||||
|
anchors.fill: parent
|
||||||
|
clip: true
|
||||||
|
clipRadius: background.radius
|
||||||
|
pressed: content.pressed
|
||||||
|
anchor: content
|
||||||
|
active: content.pressed || content.visualFocus || content.hovered
|
||||||
|
color: content.Material.rippleColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,6 +140,9 @@ Item {
|
|||||||
root.pressAndHold()
|
root.pressAndHold()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
background: Item {
|
||||||
|
implicitHeight: Style.delegateHeight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.Material
|
import QtQuick.Controls.Material
|
||||||
|
import QtQuick.Controls.Material.impl
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
import Nymea
|
import Nymea
|
||||||
@ -102,7 +103,18 @@ Item {
|
|||||||
maskSource: backgroundImgClipper
|
maskSource: backgroundImgClipper
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ripple {
|
||||||
|
anchors.fill: background
|
||||||
|
clip: true
|
||||||
|
clipRadius: background.radius
|
||||||
|
pressed: delegate.pressed
|
||||||
|
anchor: delegate
|
||||||
|
active: delegate.pressed || delegate.visualFocus || delegate.hovered
|
||||||
|
color: delegate.Material.rippleColor
|
||||||
|
}
|
||||||
|
|
||||||
ItemDelegate {
|
ItemDelegate {
|
||||||
|
id: delegate
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top; left: parent.left; right: parent.right; bottom: innerContent.top
|
top: parent.top; left: parent.left; right: parent.right; bottom: innerContent.top
|
||||||
topMargin: app.margins / 2; leftMargin: app.margins / 2; rightMargin: app.margins / 2
|
topMargin: app.margins / 2; leftMargin: app.margins / 2; rightMargin: app.margins / 2
|
||||||
@ -110,6 +122,7 @@ Item {
|
|||||||
padding: 0; topPadding: 0; bottomPadding: 0
|
padding: 0; topPadding: 0; bottomPadding: 0
|
||||||
onClicked: root.clicked()
|
onClicked: root.clicked()
|
||||||
onPressAndHold: root.pressAndHold()
|
onPressAndHold: root.pressAndHold()
|
||||||
|
background: null
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@ -217,4 +230,3 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -323,7 +323,7 @@ MainViewBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: (mouse) => {
|
||||||
var ret = itemUnderMouse()
|
var ret = itemUnderMouse()
|
||||||
if (ret.item) {
|
if (ret.item) {
|
||||||
dragArea.editIndex = ret.index
|
dragArea.editIndex = ret.index
|
||||||
|
|||||||
Reference in New Issue
Block a user