2013-09-05 2 views
0

웹캠에서 qt 빠른 응용 프로그램의 배경으로 비디오를 렌더링하려고했습니다. 나는 시험 비디오 렌더링하기 위해 5.1.1 문서에서이 코드를 사용 :QtQuick을 사용한 비디오 재생

import QtQuick 2.0 
    import QtMultimedia 5.0 

    Item { 
     MediaPlayer { 
      id: mediaplayer 
      source: "groovy_video.mp4" 
     } 

     VideoOutput { 
      anchors: parent.fill 
      source: mediaplayer 
     } 

     MouseArea { 
      id: playArea 
      anchors.fill: parent 
      onPressed: mediaplayer.play(); 
     } 
    } 

내가 더 QtQuick의 경험이없는 및 노력조차 예 (수정되지 않은) 경우는 실망 더블 :

Invalid property assignment: "anchors" is a read-only property 
anchors: parent.fill 

무엇이 잘못 되었나요?

+1

그것은, 올바른 구문이없는 문서에 오류가 있습니다. 어떤 문서 페이지입니까? 그것을 고치기 위해 – gbdivers

+0

@Guillaume Belz here http://qt-project.org/doc/qt-5.0/qtmultimedia/qml-qtmultimedia5-mediaplayer.html – iMath

답변

0

이 문제를 해결할 수 있습니다 (MouseArea처럼) : "부모 anchors.fill": "parent.fill 앵커"하지만

import QtQuick 2.0 
import QtMultimedia 5.0 

Item { 
    height: video.implicitHeight // or video.height 
    width: video.implicitWidth // or video.width 
    MediaPlayer { 
     id: mediaplayer 
     source: "groovy_video.mp4" 
    } 

    VideoOutput { 
     id: video 
     source: mediaplayer 
    } 

    MouseArea { 
     id: playArea 
     anchors.fill: parent 
     onPressed: mediaplayer.play(); 
    } 
}