IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QScreenCapture Class

The QScreenCapture class is used for capturing a screen.

This class was introduced in Qt 6.5.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QScreenCapture Class

  • Header: QScreenCapture

  • Since: Qt 6.5

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Multimedia)

    target_link_libraries(mytarget PRIVATE Qt6::Multimedia)

  • qmake: QT += multimedia

  • Inherited By:

  • Instantiated By: qml-qtmultimedia-screencapture.xml

  • Inherits: QObject

  • Inherited By:

  • Group: QScreenCapture is part of multimedia, multimedia_video

Detailed Description

The class captures a screen. It is managed by the QMediaCaptureSession class where the captured view can be displayed in a window or recorded to a file.

 
Sélectionnez
QMediaCaptureSession session;
QAudioInput audioInput;
session.setAudioInput(&input);
QMediaRecorder recorder;
session.setRecorder(&recorder);
recorder.setQuality(QMediaRecorder::HighQuality);
recorder.setOutputLocation(QUrl::fromLocalFile("test.mp3"));
recorder.record();

Member Type Documentation

 

enum QScreenCapture::Error

Enumerates error codes that can be signaled by the QScreenCapture class. errorString() provides detailed information about the error cause.

Constant

Value

Description

QScreenCapture::NoError

0

No error

QScreenCapture::InternalError

1

Internal screen capturing driver error

QScreenCapture::CapturingNotSupported

2

Capturing is not supported

QScreenCapture::CaptureFailed

3

Capturing screen failed

QScreenCapture::NotFound

4

Selected screen not found

Property Documentation

 

active : bool

This property holds whether the capturing is currently active.

Access functions:

  • bool isActive() const

  • void setActive(bool active)

Notifier signal:

  • void activeChanged(bool)

[read-only] error : const Error

This property holds the code of the last error.

Access functions:

  • error() const

Notifier signal:

[read-only] errorString : const QString

This property holds a human readable string describing the cause of error.

Access functions:

  • errorString() const

Notifier signal:

screen : QScreen*

This property holds the screen for capturing.

Access functions:

  • *screen() const

  • void setScreen( *screen)

Notifier signal:

  • void screenChanged(QScreen *)

Member Function Documentation

 

QMediaCaptureSession *QScreenCapture::captureSession() const

Returns the capture session this QScreenCapture is connected to.

Use QMediaCaptureSession::setScreenCapture() to connect the camera to a session.

void QScreenCapture::errorOccurred(QScreenCapture::Error error, const QString &errorString)

Signals when an error occurs, along with the errorString.

void QScreenCapture::start()

Starts screen capture.

void QScreenCapture::stop()

Stops screen capture.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+