Fix image selection and overlay bugs
This commit is contained in:
parent
73ecbaad10
commit
aef777d853
3
TODO.md
3
TODO.md
|
@ -8,7 +8,6 @@
|
||||||
- Qt.AlignCenter instead of V | H
|
- Qt.AlignCenter instead of V | H
|
||||||
- banner button repair
|
- banner button repair
|
||||||
- Wrong avatar for group rooms
|
- Wrong avatar for group rooms
|
||||||
- Can assign "" to an Image source
|
|
||||||
- Make sure to not cache user images and that sourceSize is set everywhere
|
- Make sure to not cache user images and that sourceSize is set everywhere
|
||||||
- Reduce messages ListView cacheBuffer height once http thumbnails
|
- Reduce messages ListView cacheBuffer height once http thumbnails
|
||||||
downloading is implemented
|
downloading is implemented
|
||||||
|
@ -107,5 +106,5 @@
|
||||||
- Previewing room without joining
|
- Previewing room without joining
|
||||||
|
|
||||||
- Distribution
|
- Distribution
|
||||||
- List dependencies
|
- Include python dependencies in binary with rcc?
|
||||||
- README.md
|
- README.md
|
||||||
|
|
|
@ -12,18 +12,12 @@ HRectangle {
|
||||||
implicitHeight: theme.avatar.size
|
implicitHeight: theme.avatar.size
|
||||||
|
|
||||||
property string name: ""
|
property string name: ""
|
||||||
property var imageUrl: null
|
property var imageUrl: ""
|
||||||
property var toolTipImageUrl: imageUrl
|
property var toolTipImageUrl: imageUrl
|
||||||
property alias fillMode: avatarImage.fillMode
|
property alias fillMode: avatarImage.fillMode
|
||||||
|
|
||||||
readonly property alias hovered: hoverHandler.hovered
|
readonly property alias hovered: hoverHandler.hovered
|
||||||
|
|
||||||
onImageUrlChanged: if (imageUrl) { avatarImage.source = imageUrl }
|
|
||||||
|
|
||||||
onToolTipImageUrlChanged: if (imageUrl) {
|
|
||||||
avatarToolTipImage.source = toolTipImageUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property var params: Utils.thumbnailParametersFor(width, height)
|
readonly property var params: Utils.thumbnailParametersFor(width, height)
|
||||||
|
|
||||||
color: imageUrl ? "transparent" :
|
color: imageUrl ? "transparent" :
|
||||||
|
@ -48,6 +42,7 @@ HRectangle {
|
||||||
sourceSize.width: params.width
|
sourceSize.width: params.width
|
||||||
sourceSize.height: params.height
|
sourceSize.height: params.height
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
|
source: Qt.resolvedUrl(imageUrl)
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: hoverHandler
|
id: hoverHandler
|
||||||
|
@ -74,6 +69,7 @@ HRectangle {
|
||||||
width: sourceSize.width
|
width: sourceSize.width
|
||||||
height: sourceSize.width
|
height: sourceSize.width
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
|
source: Qt.resolvedUrl(toolTipImageUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,12 @@ import QtQuick 2.12
|
||||||
import Qt.labs.platform 1.1
|
import Qt.labs.platform 1.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: opener
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
property alias dialog: fileDialog
|
property alias dialog: fileDialog
|
||||||
property var selectedFile: null
|
property string selectedFile: ""
|
||||||
|
property string file: ""
|
||||||
|
|
||||||
enum FileType { All, Images }
|
enum FileType { All, Images }
|
||||||
property int fileType: FileType.All
|
property int fileType: FileType.All
|
||||||
|
@ -39,8 +41,10 @@ Item {
|
||||||
modality: Qt.NonModal
|
modality: Qt.NonModal
|
||||||
|
|
||||||
onVisibleChanged: if (visible) {
|
onVisibleChanged: if (visible) {
|
||||||
selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
||||||
|
opener.file = Qt.binding(() => Qt.resolvedUrl(file))
|
||||||
}
|
}
|
||||||
onRejected: selectedFile = null
|
onAccepted: { opener.selectedFile = currentFile, opener.file = file }
|
||||||
|
onRejected: { selectedFile = null; file = null}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ HGridLayout {
|
||||||
|
|
||||||
id: avatar
|
id: avatar
|
||||||
userId: editAccount.userId
|
userId: editAccount.userId
|
||||||
imageUrl: fileDialog.selectedFile || defaultImageUrl
|
imageUrl: fileDialog.selectedFile || fileDialog.file || defaultImageUrl
|
||||||
toolTipImageUrl: null
|
toolTipImageUrl: ""
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
|
@ -54,7 +54,8 @@ HGridLayout {
|
||||||
HRectangle {
|
HRectangle {
|
||||||
z: 10
|
z: 10
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
opacity: ! avatar.imageUrl || avatar.hovered ? 1 : 0
|
opacity: ! fileDialog.dialog.visible &&
|
||||||
|
(! avatar.imageUrl || avatar.hovered) ? 1 : 0
|
||||||
Behavior on opacity { HNumberAnimation {} }
|
Behavior on opacity { HNumberAnimation {} }
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
Loading…
Reference in New Issue
Block a user