Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.11 KB | None | 0 0
  1. Rectangle{
  2.         id: rect
  3.  
  4.         width: parent.width
  5.         height: 30
  6.         MouseArea{
  7.             anchors.fill: parent
  8.             onClicked: {
  9.                 loader.source = ""
  10.                 GSignals.clearComponentCache()
  11.                 loader.sourceComponent = cameraPlayer
  12.                 loader.item.stopCamera()
  13.                 loader.item.startCamera()
  14.             }
  15.         }
  16.     }
  17.  
  18.     Loader{
  19.         id: loader
  20.  
  21.         anchors.top: rect.bottom
  22.         width: parent.width
  23.         height: parent.height - 40
  24.     }
  25.  
  26.     Component {
  27.         id: cameraPlayer
  28.  
  29.         Rectangle{
  30.  
  31.             function startCamera()
  32.             {
  33.                 camera.start()
  34.             }
  35.             function stopCamera()
  36.             {
  37.                 camera.stop()
  38.             }
  39.  
  40.             anchors.fill: parent
  41.             QMM.Camera {
  42.                 id: camera
  43.             }
  44.  
  45.             QMM.VideoOutput {
  46.                 id: videoOutput
  47.  
  48.                 autoOrientation: true
  49.                 width: parent.width
  50.                 source: camera
  51.             }
  52.         }
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement