Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Application Development with Qt Creator - Second Edition
  • Toc
  • feedback
Application Development with Qt Creator - Second Edition

Application Development with Qt Creator - Second Edition

4 (25)
close
Application Development with Qt Creator - Second Edition

Application Development with Qt Creator - Second Edition

4 (25)

Overview of this book

This book is great for developers who are new to Qt and Qt Creator and who are interested in harnessing the power of Qt for cross-platform development. If you have basic experience programming in C++, you have what it takes to create engaging cross-platform applications using Qt and Qt Creator!
Table of Contents (15 chapters)
close
14
Index

Playing video clips


Playing video is as easy as playing audio; there's a Video type that supports playing the video and displaying the video on the display. Here's a video player that plays video when you click on it and pauses and restarts the playback when you press the Space bar:

import QtQuick 2.3
import QtMultimedia 5.0

Video {
    id: video
    width : 800
    height : 600
    source: "video.avi"

    MouseArea {
        anchors.fill: parent
        onClicked: {
            video.play()
        }
    }

    focus: true
    Keys.onSpacePressed: 
        video.playbackState == MediaPlayer.PlayingState ? 
            video.pause() : 
            video.play()
}

The Keys type emits signals for the various keys that are pressed; here, we're tying the spacePressed signal to a script that pauses and plays a video.

Most of the properties of Video are the same as of Audio, except that there's no metaData property. It's a subclass of Item, so the usual positioning properties such as anchors, x...

bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete