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() { function openFullScreenImage() {
const dialog = fullScreenImage.createObject(parent, { fullScreenImageLoader.setSource("qrc:/FullScreenImage.qml", {
"image": headerMetaData.image, "image": headerMetaData.image,
"description": headerMetaData.title "description": headerMetaData.title,
"loader": fullScreenImageLoader
}); });
dialog.open(); fullScreenImageLoader.active = true;
fullScreenImageLoader.item.open();
} }
Rectangle { Rectangle {

View File

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

View File

@ -74,11 +74,13 @@ Item {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
const dialog = fullScreenImage.createObject(parent, { fullScreenImageLoader.setSource("qrc:/FullScreenImage.qml", {
"image": root.image, "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 id: syncPasswordOverlay
} }
Component { Loader {
id: fullScreenImage id: fullScreenImageLoader
FullScreenImage { } active: false
visible: active
} }
//Global Shortcuts //Global Shortcuts