Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

PictureViewer

A modal, full-screen picture viewer component. More...

Import Statement: import Felgo 4.0
Inherits:

Item

Properties

Signals

Methods

  • bool close()
  • Item show(Window window, url image, bool scaleImage)

Detailed Description

PictureViewer is a global object with convenience methods for showing a full-screen AppImage item.

The picture viewer will show a full-screen black background and the image on top, using preserve-aspect scaling. Clicking anywhere on the screen will close the picture viewer again. If available, the picture viewer also closes with the platform's back button (e.g. on Android).

Use show() to show an image specifying a source url, like:

 App {
 id: app

   AppButton {
     text: "Show image"
     onClicked: {
       // Open PictureViewer component
       PictureViewer.show(app, "image.png")
     }
   }
 }

Use close() to close a currently visible picture viewer from code.

Use currentViewer to obtain the currently visible picture viewer Item.

Property Documentation

currentViewer : Item

The currently visible picture viewer item, if any.


[read-only, since Felgo 2.7.0] isOpen : bool

Whether the PictureViewer is currently opened.

This property was introduced in Felgo 2.7.0.


Signal Documentation

[since Felgo 2.7.0] closed()

Is fired when the pictureViewer is closed. As PictureViewer is a singleton object, a Connections item is needed to access the signal:

 Connections {
   target: PictureViewer
   onClosed: { console.log("viewer closed") }
 }

Note: The corresponding handler is onClosed.

This signal was introduced in Felgo 2.7.0.


[since Felgo 2.7.0] opened(var image)

Is fired when the pictureViewer is opened. The image parameter holds the url of the shown image. As PictureViewer is a singleton object, a Connections item is needed to access the signal:

 Connections {
   target: PictureViewer
   onOpened: { console.log("viewer opened") }
 }

Note: The corresponding handler is onOpened.

This signal was introduced in Felgo 2.7.0.


Method Documentation

bool close()

Closes the currently visible picture viewer. Returns true if a dialog was currently visible.


Item show(Window window, url image, bool scaleImage)

Shows a picture viewer with the specified image source url.

The window parameter should be a reference to the root QML Window, or in many cases the App object. If it is not specified, the picture viewer will not work.

scaleImage is an optional parameter and defaults to true. When set to false, the image is not scaled up to fit the screen if it is smaller. Images that are too big are always scaled down to fit the screen.

Returns the created picture viewer item if it has been opened, and no InputDialog was already opened before the call, otherwise returns the previously visible picture viewer Item.

Note: Only one PictureViewer can be shown at a time. If a dialog is currently visible, nothing happens and this dialog is returned.


Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded