Put fullscreen image viewer in Loader

This commit is contained in:
Bart De Vries 2023-02-01 11:30:36 +01:00
parent 58b519c939
commit 72646f5075
4 changed files with 16 additions and 9 deletions

View File

@ -56,11 +56,13 @@ FocusScope {
}
function openFullScreenImage() {
const dialog = fullScreenImage.createObject(parent, {
fullScreenImageLoader.setSource("qrc:/FullScreenImage.qml", {
"image": headerMetaData.image,
"description": headerMetaData.title
"description": headerMetaData.title,
"loader": fullScreenImageLoader
});
dialog.open();
fullScreenImageLoader.active = true;
fullScreenImageLoader.item.open();
}
Rectangle {

View File

@ -15,6 +15,7 @@ Controls.Popup {
id: root
required property var image
required property QtObject loader
property string description: undefined
property int imageWidth: -1
@ -201,5 +202,6 @@ Controls.Popup {
onClosed: {
imageItem.scaleFactor = 1;
imageItem.rotationAngle = 0;
loader.active = false;
}
}

View File

@ -74,11 +74,13 @@ Item {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
const dialog = fullScreenImage.createObject(parent, {
fullScreenImageLoader.setSource("qrc:/FullScreenImage.qml", {
"image": root.image,
"description": root.title
"description": root.title,
"loader": fullScreenImageLoader
});
dialog.open();
fullScreenImageLoader.active = true;
fullScreenImageLoader.item.open();
}
}
}

View File

@ -478,9 +478,10 @@ Kirigami.ApplicationWindow {
id: syncPasswordOverlay
}
Component {
id: fullScreenImage
FullScreenImage { }
Loader {
id: fullScreenImageLoader
active: false
visible: active
}
//Global Shortcuts