Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On GUI Programming with C++ and Qt5

You're reading from   Hands-On GUI Programming with C++ and Qt5 Build stunning cross-platform applications and widgets with the most powerful GUI framework

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher Packt
ISBN-13 9781788397827
Length 404 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Lee Zhi Eng Lee Zhi Eng
Author Profile Icon Lee Zhi Eng
Lee Zhi Eng
Lee  Z Eng Lee Z Eng
Author Profile Icon Lee Z Eng
Lee Z Eng
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Introduction to Qt FREE CHAPTER 2. Qt Widgets and Style Sheets 3. Database Connection 4. Graphs and Charts 5. Item Views and Dialogs 6. Integrating Web Content 7. Map Viewer 8. Graphics View 9. The Camera Module 10. Instant Messaging 11. Implementing a Graphics Editor 12. Cloud Storage 13. Multimedia Viewers 14. Qt Quick and QML 15. Cross-Platform Development 16. Testing and Debugging 17. Other Books You May Enjoy

Recording a camera video to file

After we have learned how to capture a still image from our camera, let's proceed to learn how to record videos as well. First, open mainwindow.h and add the following variables:

private: 
   Ui::MainWindow *ui; 
   QCamera* camera; 
   QCameraViewfinder* viewfinder; 
   QCameraImageCapture* imageCapture; 
   QMediaRecorder* recorder; 
 
   bool connected; 
   bool recording; 

Next, open mainwindow.ui again and right-click on the Record button. Choose Go to slot... from the menu and select the clicked() option, then, click the OK button. A slot function will be created for you; then proceed to add the following code into the slot function:

void MainWindow::on_recordButton_clicked() 
{ 
   if (connected) 
   { 
         if (!recording) 
         { 
               recorder = new QMediaRecorder(camera); 
               camera->setCaptureMode...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image