Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112643

Invalid ScreenCapture work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.0
    • Multimedia
    • None
    • Windows

    Description

      Qt 6.5 introduced `ScreenCapture` class which should record a screen.
      Check an [example](https://doc.qt.io/qt-6/qml-qtmultimedia-screencapture.html#details)

       

      ApplicationWindow {
        id: root
        MouseArea {
          id: recording
          anchors.fill: parent
          property bool inProcess: false
          onClicked: {
            if (recording.inProcess) {
              screenCapture.active = recording.inProcess = false;
              recorder.stop();  
            } else {
              screenCapture.active = recording.inProcess = true;
              recorder.record();
            }
          }
        }
        CaptureSession {
          id: captureSession
          screenCapture: ScreenCapture {
            id: screenCapture
            active: false 
            // window: root <- it fails
          }
          recorder: MediaRecorder {
            id: recorder
            mediaFormat {
              fileFormat: MediaFormat.MPEG4
              videoCodec: MediaFormat.VideoCodec.H265
            }
            outputLocation: "desired-name.mp4"
            quality: MediaRecorder.HighQuality
          }
        }
      } 

       

       

      But then I wanted to capture a window, not a whole screen.
      Due to documentation, `ScreenCapture` has a `window: Window` property to achieve that, but when I add 
      `window: root` to it, I got an error: `Cannot assign to non-existent property "window"`

      The other thing with doc is `screen: bool`, but when I tried to compile it, QML says that its not a boolean.

      Attachments

        1. error.png
          5 kB
          Sergey Kashtanov
        2. error-1.png
          13 kB
          Sergey Kashtanov

        Activity

          People

            laknoll Lars Knoll
            excommunicado Sergey Kashtanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: