remove loader from image so the icons are not reloaded each time a list layout change
remove button color warning
This commit is contained in:
parent
fa3ef0b1a8
commit
7a4adbcbb4
3 changed files with 71 additions and 78 deletions
|
|
@ -52,14 +52,14 @@ Control.Button {
|
||||||
property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3)
|
property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3)
|
||||||
// Image properties
|
// Image properties
|
||||||
property var contentImageColor: style?.image? style.image.normal : DefaultStyle.main2_600
|
property var contentImageColor: style?.image? style.image.normal : DefaultStyle.main2_600
|
||||||
property var hoveredImageColor: style?.image? style.image.hovered : Qt.darker(contentImageColor, 1.05)
|
property var hoveredImageColor: style && style.image && style.image.hovered ? style.image.hovered : Qt.darker(contentImageColor, 1.05)
|
||||||
property var checkedImageColor: style?.image? style.image.checked : Qt.darker(contentImageColor, 1.1)
|
property var checkedImageColor: style && style.image && style.image.checked ? style.image.checked : Qt.darker(contentImageColor, 1.1)
|
||||||
property var pressedImageColor: style?.image? style.image.pressed : Qt.darker(contentImageColor, 1.1)
|
property var pressedImageColor: style && style.image && style.image.pressed ? style.image.pressed : Qt.darker(contentImageColor, 1.1)
|
||||||
icon.source: style?.iconSource || ""
|
icon.source: style?.iconSource || ""
|
||||||
property color colorizationColor: checkable && checked
|
property color colorizationColor: checkable && checked
|
||||||
? checkedImageColor
|
? checkedImageColor
|
||||||
: pressed
|
: pressed
|
||||||
? pressedImageColor
|
? pressedImageColor
|
||||||
: hovered
|
: hovered
|
||||||
? hoveredImageColor
|
? hoveredImageColor
|
||||||
: contentImageColor
|
: contentImageColor
|
||||||
|
|
@ -153,7 +153,6 @@ Control.Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
component ButtonImage: EffectImage {
|
component ButtonImage: EffectImage {
|
||||||
asynchronous: mainItem.asynchronous
|
|
||||||
imageSource: mainItem.icon.source
|
imageSource: mainItem.icon.source
|
||||||
imageWidth: mainItem.icon.width
|
imageWidth: mainItem.icon.width
|
||||||
imageHeight: mainItem.icon.height
|
imageHeight: mainItem.icon.height
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ Loader{
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
width: parent.width / 4.5
|
width: parent.width / 4.5
|
||||||
height: width
|
height: width
|
||||||
asynchronous: true
|
|
||||||
imageSource: mainItem.secured ? AppIcons.trusted : AppIcons.notTrusted
|
imageSource: mainItem.secured ? AppIcons.trusted : AppIcons.notTrusted
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,85 +5,80 @@ import QtQuick.Effects
|
||||||
|
|
||||||
import Linphone
|
import Linphone
|
||||||
|
|
||||||
// The loader is needed here to refresh the colorization effect (effect2) which is not refreshed when visibility change
|
// TODO : A loader may be needed here to refresh the colorization effect (effect2) which is not refreshed when visibility change
|
||||||
// and causes colorization issue when effect image is inside a popup
|
// and causes colorization issue when effect image is inside a popup (not seen in the popup recently tested, may be an obsolete bug)
|
||||||
Loader {
|
Item {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
active: visible
|
|
||||||
property url imageSource: ""
|
property url imageSource: ""
|
||||||
property var fillMode: Image.PreserveAspectFit
|
property var fillMode: Image.PreserveAspectFit
|
||||||
property var colorizationColor
|
property var colorizationColor
|
||||||
property real imageWidth: width
|
property real imageWidth: width
|
||||||
property real imageHeight: height
|
property real imageHeight: height
|
||||||
property bool useColor: colorizationColor != undefined
|
property bool useColor: colorizationColor != undefined
|
||||||
property bool shadowEnabled: false
|
property bool shadowEnabled: false
|
||||||
property bool isImageReady: false
|
property bool isImageReady: false
|
||||||
asynchronous: true
|
Image {
|
||||||
sourceComponent: Component{Item {
|
id: image
|
||||||
Image {
|
visible: !effect2.effectEnabled
|
||||||
id: image
|
source: mainItem.imageSource
|
||||||
visible: !effect2.effectEnabled
|
fillMode: mainItem.fillMode
|
||||||
source: mainItem.imageSource
|
sourceSize.width: width
|
||||||
fillMode: mainItem.fillMode
|
sourceSize.height: height
|
||||||
sourceSize.width: width
|
width: mainItem.imageWidth
|
||||||
sourceSize.height: height
|
height: mainItem.imageHeight
|
||||||
width: mainItem.imageWidth
|
Layout.preferredWidth: mainItem.imageWidth
|
||||||
height: mainItem.imageHeight
|
Layout.preferredHeight: mainItem.imageHeight
|
||||||
Layout.preferredWidth: mainItem.imageWidth
|
anchors.centerIn: parent
|
||||||
Layout.preferredHeight: mainItem.imageHeight
|
onStatusChanged: mainItem.isImageReady = (status == Image.Ready)
|
||||||
anchors.centerIn: parent
|
|
||||||
onStatusChanged: mainItem.isImageReady = (status == Image.Ready)
|
|
||||||
}
|
|
||||||
MultiEffect {
|
|
||||||
id: effect
|
|
||||||
visible: false
|
|
||||||
anchors.fill: image
|
|
||||||
source: image
|
|
||||||
maskSource: image
|
|
||||||
brightness: effect2.effectEnabled ? 1.0 : 0.0
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiEffect {
|
|
||||||
id: effect2
|
|
||||||
enabled: effectEnabled
|
|
||||||
visible: mainItem.useColor
|
|
||||||
property bool effectEnabled: mainItem.useColor
|
|
||||||
anchors.fill: effect
|
|
||||||
source: effect
|
|
||||||
maskSource: effect
|
|
||||||
colorizationColor: effectEnabled && mainItem.colorizationColor ? mainItem.colorizationColor : 'black'
|
|
||||||
colorization: effectEnabled ? 1.0: 0.0
|
|
||||||
}
|
|
||||||
/* Alernative to shadow for no blackcolors
|
|
||||||
MultiEffect {
|
|
||||||
visible: mainItem.shadowEnabled
|
|
||||||
source: image
|
|
||||||
width: image.width
|
|
||||||
height: image.height
|
|
||||||
x: image.x
|
|
||||||
y: image.y + 6
|
|
||||||
z: -1
|
|
||||||
blurEnabled: true
|
|
||||||
blurMax: 12
|
|
||||||
blur: 1.0
|
|
||||||
contrast: -1.0
|
|
||||||
brightness: 1.0
|
|
||||||
colorizationColor: DefaultStyle.grey_400
|
|
||||||
colorization: 1.0
|
|
||||||
}*/
|
|
||||||
MultiEffect {
|
|
||||||
id: shadow
|
|
||||||
enabled: mainItem.shadowEnabled
|
|
||||||
anchors.fill: image
|
|
||||||
source: image
|
|
||||||
visible: mainItem.shadowEnabled
|
|
||||||
// Crash : https://bugreports.qt.io/browse/QTBUG-124730?
|
|
||||||
shadowEnabled: true //mainItem.shadowEnabled
|
|
||||||
shadowColor: DefaultStyle.grey_1000
|
|
||||||
shadowBlur: 0
|
|
||||||
shadowOpacity: mainItem.shadowEnabled ? 0.7 : 0.0
|
|
||||||
z: mainItem.z - 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
MultiEffect {
|
||||||
|
id: effect
|
||||||
|
visible: false
|
||||||
|
anchors.fill: image
|
||||||
|
source: image
|
||||||
|
maskSource: image
|
||||||
|
brightness: effect2.effectEnabled ? 1.0 : 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiEffect {
|
||||||
|
id: effect2
|
||||||
|
enabled: effectEnabled
|
||||||
|
visible: mainItem.useColor
|
||||||
|
property bool effectEnabled: mainItem.useColor
|
||||||
|
anchors.fill: effect
|
||||||
|
source: effect
|
||||||
|
maskSource: effect
|
||||||
|
colorizationColor: effectEnabled && mainItem.colorizationColor ? mainItem.colorizationColor : 'black'
|
||||||
|
colorization: effectEnabled ? 1.0: 0.0
|
||||||
|
}
|
||||||
|
/* Alernative to shadow for no blackcolors
|
||||||
|
MultiEffect {
|
||||||
|
visible: mainItem.shadowEnabled
|
||||||
|
source: image
|
||||||
|
width: image.width
|
||||||
|
height: image.height
|
||||||
|
x: image.x
|
||||||
|
y: image.y + 6
|
||||||
|
z: -1
|
||||||
|
blurEnabled: true
|
||||||
|
blurMax: 12
|
||||||
|
blur: 1.0
|
||||||
|
contrast: -1.0
|
||||||
|
brightness: 1.0
|
||||||
|
colorizationColor: DefaultStyle.grey_400
|
||||||
|
colorization: 1.0
|
||||||
|
}*/
|
||||||
|
MultiEffect {
|
||||||
|
id: shadow
|
||||||
|
enabled: mainItem.shadowEnabled
|
||||||
|
anchors.fill: image
|
||||||
|
source: image
|
||||||
|
visible: mainItem.shadowEnabled
|
||||||
|
// Crash : https://bugreports.qt.io/browse/QTBUG-124730?
|
||||||
|
shadowEnabled: true //mainItem.shadowEnabled
|
||||||
|
shadowColor: DefaultStyle.grey_1000
|
||||||
|
shadowBlur: 0
|
||||||
|
shadowOpacity: mainItem.shadowEnabled ? 0.7 : 0.0
|
||||||
|
z: mainItem.z - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue