
End to End GUI Development with Qt5
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions

Content
- Cover
- Title Page - Courses
- Copyright and Credits - Courses
- Packt Upsell - Courses
- Table of Contents
- Preface
- Module 1: Learn Qt 5
- Chapter 1: Hello Qt
- Installing Qt
- Maintaining your installation
- Qt Creator
- Scratchpad project
- qmake
- Summary
- Chapter 2: Project Structure
- Projects, MVC, and unit testing
- Project creation
- cm-lib
- cm-tests
- cm-ui
- Mastering MVC
- QObject
- QML
- Project output
- Summary
- Chapter 3: User Interface
- UX
- Creating views
- StackView
- Anchors
- Sizing
- Navigation
- Fixing conflicts
- Summary
- Chapter 4: Style
- Style resource
- Font Awesome
- Components
- Styling the navigation bar
- Clicking
- Commands
- Command bar
- Summary
- Chapter 5: Data
- JSON
- Object hierarchy
- DataDecorators
- Entities
- Entity collections
- Data models
- Custom TextBox
- Summary
- Chapter 6: Unit Testing
- Unit testing
- The default Qt approach
- Custom approach
- DataDecorator tests
- Entity Tests
- Mocking
- Summary
- Chapter 7: Persistence
- SQLite
- Primary keys
- Creating clients
- Panels
- Finding clients
- Editing clients
- Deleting clients
- Summary
- Chapter 8: Web Requests
- Network access
- Web Requests
- RSS View
- RSS
- Summary
- Chapter 9: Wrapping Up
- Object factory
- UI scaling
- Dashboard
- Enumerator selectors
- Contacts
- Deployment preparation
- OS X
- Linux
- Windows
- Qt Installer framework
- Installation
- Summary
- Module 2: Mastering Qt 5
- Chapter 10: Discovering QMake Secrets
- Designing a cross-platform project
- Adding the Windows implementation
- Adding the Linux implementation
- Adding the Mac OS implementation
- Transforming SysInfo into a singleton
- Exploring Qt Charts
- CpuWidget using QCharts
- Memory using Qcharts
- The .pro file in depth
- Under the hood of qmake
- Beneath Q_OBJECT and signals/slots
- Summary
- Chapter 11: Dividing Your Project and Ruling Your Code
- Designing a maintainable project
- Defining data classes
- Storing your data in a database
- Protecting your code with a smart pointer
- Implementing the model
- Summary
- Chapter 12: Conquering the Desktop UI
- Creating a GUI linked to a core shared library
- Listing your albums with AlbumListWidget
- Creating a ThumbnailProxyModel
- Displaying the selected album with AlbumWidget
- Enhancing thumbnails with PictureDelegate
- Displaying a picture with PictureWidget
- Composing your Gallery app
- Summary
- Chapter 13: Dominating the Mobile UI
- Starting with Qt Quick and QML
- Checking your development environment
- Creating a Qt Quick project
- Preparing your Qt Quick gallery entry point
- Displaying albums with ListView
- Theming the application with a QML singleton
- Loading a database on mobile
- Creating a new album from a custom InputDialog
- Loading images with an ImageProvider
- Displaying thumbnails in a GridView
- Swiping through full resolution pictures
- Summary
- Chapter 14: Even Qt Deserves a Slice of Raspberry Pi
- Discovering Qt3D
- Configuring Qt for your Raspberry Pi
- Creating an entry point for your Qt3D code
- Setting up the scene
- Assembling your Qt3D entities
- Preparing the board game
- Crafting entities from the factory
- Building a snake engine in JavaScript
- Varying the HUD with QML states
- Profiling your QML application
- Summary
- Chapter 15: Third-Party Libraries Without a Headache
- Creating your Qt Designer plugin
- Configuring the project for Windows
- Configuring the project for Linux
- Configuring the project for Mac
- Implementing your OpenCV filters
- Designing the UI with FilterWidget
- Exposing your plugin to Qt Designer
- Using your Qt Designer plugin
- Building the image-filter application
- Summary
- Chapter 16: Animations - Its Alive, Alive!
- Preparing an SDK
- Creating your plugins
- Loading your plugins dynamically
- Using the plugins inside the application
- Discovering the Animation Framework
- Making your thumbnails jump
- Fading the picture in
- Flashing the thumbnail in a sequence
- Summary
- Chapter 17: Keeping Your Sanity with Multithreading
- Discovering QThread
- Flying over Qt multithreading technologies
- Architecting the Mandelbrot project
- Defining a Job class with QRunnable
- Using QThreadPool in MandelbrotCalculator
- Displaying the fractal with MandelbrotWidget
- Summary
- Chapter 18: Need IPC? Get Your Minions to Work
- Architecturing an IPC project
- Laying down the foundations with an SDK
- Working with QDataStream and QTcpSocket
- Interacting with sockets in the worker
- Interacting with sockets from the application
- Building your own QTcpServer
- Summary
- Chapter 19: Having Fun with Serialization
- Architecting the drum machine project
- Creating a drum track
- Making your objects serializable with QVariant
- Serializing objects in JSON format
- Serializing objects in XML format
- Serializing objects in binary format
- Playing low latency sounds with QSoundEffect
- Triggering a QButton with your keyboard
- Bringing PlaybackWorker to life
- Accepting mouse drag and drop events
- Summary
- Chapter 20: You Shall (Not) Pass with QTest
- Discovering Qt Test
- Executing your tests
- Writing factorized tests with datasets
- Benchmarking your code
- Testing your GUI
- Spying on your application with QSignalSpy
- Summary
- Chapter 21: All Packed and Ready to Deploy
- Packaging your application
- Packaging for Windows
- Packaging for Linux with a distribution package
- Packaging for Linux with AppImage
- Packaging for Mac OS X
- Packaging for Android
- Packaging for iOS
- Summary
- Chapter 22: Qt Hat Tips and Tricks
- Managing your workspace with sessions
- Searching with the Locator
- Increasing the compilation speed
- Examining the memory with Qt Creator
- Generating random numbers
- Silencing unused variable warnings
- Logging custom objects to QDebug
- Improving log messages
- Saving your logs to a file
- Generating a command-line interface
- Sending and receiving HTTP data
- Summary
- Module 3: Qt 5 Projects
- Chapter 23: Writing Acceptance Tests and Building a Visual Prototype
- Don't come to me with an idea, come to me with a plan
- The problem - what's in my fridge?
- The solution - an app idea
- The plan - start from user stories
- Writing features and scenarios
- Implementing scenarios as acceptance tests
- Our project structure
- QML and C++ - when to use each of them
- Writing the first acceptance tests in C++
- Creating the first C++ test case
- Adding the first C++ test
- Given there is a list of available grocery items
- And (given) one or more grocery items are actually available
- When I check available groceries
- Then I am given the list of available grocery items
- And (then) the grocery items are ordered by name, ascending
- A huge step for humanity
- Writing usecase tests in QML
- A short QML primer
- Expressing the first acceptance test in QML
- Building a visual prototype
- Deciding upon the UI technology
- What kind of visual metaphors should our application use?
- What kind of devices should our application run on?
- Should a non-coding designer implement the UI?
- Why limit yourself to one?
- Our initial choice
- Prototyping with Qt Quick Designer
- Creating the UI subproject
- Laying out the UI components required by the scenarios
- Check available groceries
- Add grocery item
- Remove grocery item
- Taking it further
- Summary
- Chapter 24: Defining a Solid and Testable App Core
- Implementing the first usecase
- Creating the usecase class
- Anatomy of a QObject-derived class
- Describing the usecase flow with signals and slots
- From usecases to business objects
- Introducing the almighty QVariant
- Implementing the GroceryItems entity
- Implementing a fake data repository
- Making the first usecase test pass
- Using the AutoTest plugin
- Wait a second!
- Adding a textual user interface
- Setting up the console application project
- Writing the textual application
- QCoreApplication's many responsibilities
- Creating the business objects
- Defining application output upon success
- Collecting and acting upon user input
- Running the console app
- About unit testing
- Summary
- Chapter 25: Wiring User Interaction and Delivering the Final App
- Completing the app's core functionality
- Adding a grocery item
- Defining the precondition step
- Test init and cleanup
- Defining the usecase action step
- Defining the first outcome step
- Defining the second outcome step
- use case implementation
- Implementing the GroceryItems entity
- Removing a grocery item
- Adding a fridge
- Connecting visual input/output and usecases
- Setting up the client application
- Exposing C++ objects to QML
- QML engines and contexts
- Exposing object instances via context properties
- Triggering usecases from the UI
- Triggering usecases::CheckAvailabeGroceries::run
- Triggering usecases::AddGroceryItem::run
- Triggering usecases::RemoveGroceryItem::run
- Showing usecase outcomes in the UI
- Exposing the groceryItems list to QML
- Binding groceriesListView.model to groceryItems.list
- Trying out the usecases from the UI
- Improving the UI
- Deploying the app
- Deploying the app to macOS
- Deploying the app to Windows
- Deploying the app to Android
- Deploying the app to iOS
- Deploying the app to Linux
- Summary
- Chapter 26: Learning About Laying Out Components by Making a Page Layout Tool
- A tool to prototype page layouts quickly
- Initial setup
- Creating sub-projects
- Previewing QML code
- Creating a QML module
- Creating a Qt Resource Collection
- Back to scenarios
- Adding a panel to the page
- Implementing usecases and entities
- Designing and implementing the UI for the usecase
- The anchors positioning model
- Adding the page
- Creating the comic panels
- The Qt Quick Layouts system
- Managing comic panels with a grid layout
- Creating new panels dynamically with a repeater
- Defining the comic panel
- Simulating the usecase action
- Removing a panel from the page
- Taking a picture and loading it into a panel
- Loading an existing picture into a panel
- Summary
- Chapter 27: Creating a Scene Composer to Explore 3D Capabilities
- Arranging 3D elements in a composition
- Defining feature scenarios
- Adding elements to a composition
- Removing elements from a composition
- Saving a composition as an image
- Defining entities and their visual counterparts
- Introducing Qt 3D
- Comparing C++ and QML APIs
- Previewing Qt 3D entities in QML
- The Element entity
- Adding visual components to the element
- Varying the properties of the mesh
- Changing the element's position
- Selecting an element
- Dealing with user input
- Keeping track of the currently selected element
- The Composition entity
- Having the composition reference a list of entities
- Previewing the composition
- Adding elements to the composition
- Adding camera and interaction to the composition
- Adding custom lighting and changing the background color
- Creating the client application
- Exporting QML components in a namespaced module
- Setting up the client application
- Creating the 2D controls
- Adding the controls menu and the element creation options
- Adding the Background color selector and the grab image button
- Prototyping the usecases in JavaScript
- Adding the elements business object
- Adding the usecases
- Implementing add element to Composition
- Implementing remove element from composition
- Implementing save composition to an image
- Going further
- Summary
- Chapter 28: Building an Entity-Aware Text Editor for Writing Dialogue
- Writing comic scripts efficiently
- Defining use cases
- Setting up the project
- Prototyping the UI
- Introducing Qt Widgets
- Using Qt Widgets Designer
- Adding the main layout
- Adding the left column and the text editor
- Adding the List View, button, and line edit
- Implementing the characters entity
- Introducing QAbstractItemModel and QAbstractListModel
- Creating the characters entity
- Adding a character to the characters model
- Inserting a character's name into the dialogue script
- Auto-highlighting a character name
- Saving the comic script
- Exporting the comic script to PDF
- Styling the UI
- Summary
- Chapter 29: Sending Sensor Readings to a Device with a Non-UI App
- Outline
- Setting up the project
- Publishing sensor readings
- Setting up the use case project
- Implementing the background steps
- Defining the sensor entity
- Introducing Qt Sensors
- Modeling the sensor abstraction
- Implementing the Broadcaster entity
- Adding the broadcaster Bluetooth channel
- Setting up the channel project
- Defining the BroadcasterChannel API
- Introducing the Qt Bluetooth module
- Creating the channel base and derived classes
- Implementing the channel initialization method
- Making the server listen to the adapter
- Providing information about the service ID
- Providing information about the service's textual descriptors
- Providing information about service discoverability
- Providing information about the transport protocol
- Registering the service with the adapter
- Connecting the broadcaster channel to the Broadcaster entity
- Gluing components into the CM Broadcast console app
- Including and instantiating the components
- Testing the service discovery
- Summary
- Chapter 30: Building a Mobile Dashboard to Display Real-Time Sensor Data
- Overview
- Project setup
- Setting up the CM Monitor project
- Creating the Bluetooth Receiver channel project
- Implementing the Bluetooth Receiver channel
- Implementing the init method
- Implementing the receiveReadings method
- Having the broadcaster emit readings at regular intervals
- Checking the broadcaster-receiver communication
- Implementing the readings chart
- Introducing QtCharts
- Adding a line series to the chart view
- Wiring the receiverChannel to the chart
- Adding internationalization support
- Marking strings for translation
- Generating the XML translation files
- Translating a string
- Compiling translations
- Loading translations
- Summary
- Chapter 31: Running a Web Service and an HTML5 Dashboard
- Overview
- Creating a BroadcasterChannel based on HTTP
- Networking support in Qt
- Compiling and linking the QHttp library
- Adding the QHttp library to the channel broadcaster project
- Implementing the HTTP BroadcasterChannel
- Making an HTTP ReceiverChannel implementation
- Subclassing the ReceiverChannel
- Implementing the constructor and init method
- Performing the HTTP request and consuming the response
- Implementing an HTML5 UI
- Browser technologies in Qt: WebEngine, WebView, and WebKit
- Adding WebEngineView to cmmonitor
- Data transport between app and browser with WebChannel
- Adding an HTML5 time series
- Summary
- Chapter 32: Additional and Upcoming Qt Features
- Additional Qt features in 5.9 LTS
- New and upcoming Qt features
- Bibliography
- Index
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.