SHARE
TWEET

Untitled

tham7777 Feb 24th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Felgo 3.0
  2. import QtQuick 2.0
  3.  
  4. import QtMultimedia 5.9 as QMM
  5.  
  6. App {
  7.     id: app
  8.     // You get free licenseKeys from https://felgo.com/licenseKey
  9.     // With a licenseKey you can:
  10.     //  * Publish your games & apps for the app stores
  11.     //  * Remove the Felgo Splash Screen or set a custom one (available with the Pro Licenses)
  12.     //  * Add plugins to monetize, analyze & improve your apps (available with the Pro Licenses)
  13.     // licenseKey:
  14.  
  15.     // Local storage component
  16.     Storage {
  17.         id: storage
  18.     }
  19.  
  20.     Constant{ id: constant }
  21.  
  22.     Rectangle{
  23.         id: rect
  24.  
  25.         width: parent.width
  26.         height: dp(80)
  27.  
  28.         Text{
  29.             anchors.fill: parent
  30.             text: "click me"
  31.         }
  32.  
  33.         MouseArea{
  34.             anchors.fill: parent
  35.             onClicked: {
  36.                 loader.source = ""
  37.                 GSignals.clearComponentCache()
  38.                 loader.sourceComponent = cameraPlayer
  39.                 loader.item.stopCamera()
  40.                 loader.item.startCamera()
  41.             }
  42.         }
  43.     }
  44.  
  45.     Loader{
  46.         id: loader
  47.  
  48.         anchors.top: rect.bottom
  49.         width: parent.width
  50.         height: parent.height - dp(80)
  51.     }
  52.  
  53.     Component {
  54.         id: cameraPlayer
  55.  
  56.         Rectangle{
  57.  
  58.             function startCamera()
  59.             {
  60.                 camera.start()
  61.             }
  62.             function stopCamera()
  63.             {
  64.                 camera.stop()
  65.             }
  66.  
  67.             anchors.fill: parent
  68.             QMM.Camera {
  69.                 id: camera
  70.             }
  71.  
  72.             QMM.VideoOutput {
  73.                 id: videoOutput
  74.  
  75.                 autoOrientation: true
  76.                 width: parent.width
  77.                 source: camera
  78.             }
  79.         }
  80.     }  
  81. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top