[ui] add string <--> file representation convertors

* convenient methods to conform strings to Qt file reprensentation using the "file:/" protocol prefix
* use those methodes when manipulating files
This commit is contained in:
Yann Lanthony 2018-02-26 16:59:25 +01:00
parent 62726b4663
commit 2cdc83f06f
7 changed files with 38 additions and 6 deletions

View file

@ -2,12 +2,13 @@ import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import MaterialIcons 2.2
import Utils 1.0
FocusScope {
id: root
clip: true
property alias source: image.source
property string source
property var metadata
// slots
@ -48,6 +49,7 @@ FocusScope {
fillMode: Image.PreserveAspectFit
autoTransform: true
onWidthChanged: if(status==Image.Ready) fit()
source: Filepath.stringToFile(root.source)
onStatusChanged: {
// update cache source when image is loaded
if(status === Image.Ready)