Fix image selection and overlay bugs

This commit is contained in:
miruka 2019-07-16 04:37:39 -04:00
parent 73ecbaad10
commit aef777d853
4 changed files with 15 additions and 15 deletions

View File

@ -8,7 +8,6 @@
- Qt.AlignCenter instead of V | H
- banner button repair
- Wrong avatar for group rooms
- Can assign "" to an Image source
- Make sure to not cache user images and that sourceSize is set everywhere
- Reduce messages ListView cacheBuffer height once http thumbnails
downloading is implemented
@ -107,5 +106,5 @@
- Previewing room without joining
- Distribution
- List dependencies
- Include python dependencies in binary with rcc?
- README.md

View File

@ -12,18 +12,12 @@ HRectangle {
implicitHeight: theme.avatar.size
property string name: ""
property var imageUrl: null
property var imageUrl: ""
property var toolTipImageUrl: imageUrl
property alias fillMode: avatarImage.fillMode
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)
color: imageUrl ? "transparent" :
@ -48,6 +42,7 @@ HRectangle {
sourceSize.width: params.width
sourceSize.height: params.height
fillMode: Image.PreserveAspectCrop
source: Qt.resolvedUrl(imageUrl)
HoverHandler {
id: hoverHandler
@ -74,6 +69,7 @@ HRectangle {
width: sourceSize.width
height: sourceSize.width
fillMode: Image.PreserveAspectCrop
source: Qt.resolvedUrl(toolTipImageUrl)
}
}
}

View File

@ -5,10 +5,12 @@ import QtQuick 2.12
import Qt.labs.platform 1.1
Item {
id: opener
anchors.fill: parent
property alias dialog: fileDialog
property var selectedFile: null
property string selectedFile: ""
property string file: ""
enum FileType { All, Images }
property int fileType: FileType.All
@ -39,8 +41,10 @@ Item {
modality: Qt.NonModal
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}
}
}

View File

@ -43,8 +43,8 @@ HGridLayout {
id: avatar
userId: editAccount.userId
imageUrl: fileDialog.selectedFile || defaultImageUrl
toolTipImageUrl: null
imageUrl: fileDialog.selectedFile || fileDialog.file || defaultImageUrl
toolTipImageUrl: ""
Layout.alignment: Qt.AlignHCenter
@ -54,7 +54,8 @@ HGridLayout {
HRectangle {
z: 10
visible: opacity > 0
opacity: ! avatar.imageUrl || avatar.hovered ? 1 : 0
opacity: ! fileDialog.dialog.visible &&
(! avatar.imageUrl || avatar.hovered) ? 1 : 0
Behavior on opacity { HNumberAnimation {} }
anchors.fill: parent