Forums

OverviewV-Play 1 SupportPicture Viewer hide device statusbar › Reply To: Picture Viewer hide device statusbar

OverviewV-Play 1 SupportPicture Viewer hide device statusbar › Reply To: Picture Viewer hide device statusbar
#12190

Günther
V-Play Team

Hi David!

Good question! Had to play around a bit myself to work that one out 😉

The tricky part is how to find out when the viewer is closed. Luckily the show method returns the viewer item, which has a property isOpen that we can use:

import VPlayApps 1.0
import QtQuick 2.0

App {
  id: app

  // react to closing the picture viewer
  property Item viewer: null
  Connections {
    target: viewer
    onIsOpenChanged: if(!viewer.isOpen) Theme.colors.statusBarStyle = Theme.colors.statusBarStyleBlack
  }

  Page {
    // show image
    Image {
      source: "../assets/vplay-logo.png"
      anchors.centerIn: parent

      // open viewer if image clicked
      MouseArea {
        anchors.fill: parent
        onClicked: {
          viewer = PictureViewer.show(app, parent)
          Theme.colors.statusBarStyle = Theme.colors.statusBarStyleHidden
        }
      }
    }
  }
}

 

The Connections object allows to define a handler for signals of a certain target item, which is what we can use to find out when the viewer was closed. You can use this solution for now.

 

While I was researching your problem, I made some adjustments to the PictureViewer item. As from the next V-Play release you can use it like this:

import VPlayApps 1.0
import QtQuick 2.0

App {
  id: app

  // react to closing the picture viewer
  Connections {
    target: PictureViewer
    onClosed: Theme.colors.statusBarStyle = Theme.colors.statusBarStyleBlack
  }

  Page {
    // show image
    Image {
      source: "../assets/vplay-logo.png"
      anchors.centerIn: parent

      // open viewer if image clicked
      MouseArea {
        anchors.fill: parent
        onClicked: {
          PictureViewer.show(app, parent.source)
          Theme.colors.statusBarStyle = Theme.colors.statusBarStyleHidden
        }
      }
    }
  }
}

 

It will be possible to directly access onClosed and onOpened signals of the PictureViewer. Also, it will be possible to pass an url to the show method. (The current version expects an Image item.)

Best,
Günther

 

 

  • This reply was modified 2 years, 7 months ago by  GT.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support