PySide6 Blueprints

PySide6 Blueprints

Uros Calakovic
This is a sample of the book's content.Buy on Leanpub

Table of Contents

Part I: Foundations›

  • 1. Getting Started
    • 1.1 Installation
    • 1.2 A Reusable Starting Point
    • 1.3 Adding Widgets to the Window
    • 1.4 Reading the Qt Documentation
    • 1.5 A Map of Qt Widgets
  • 2. Signals & Slots
    • 2.1 Connecting a Signal to a Slot
    • 2.2 Passing Arguments to Slots
  • 3. Qt Widgets Layouts
    • 3.1 Stacking Widgets Vertically - QVBoxLayout
    • 3.2 Placing Widgets Side by Side - QHBoxLayout
    • 3.3 Nesting Layouts
    • 3.4 Arranging Widgets in a Grid - QGridLayout
    • 3.5 Laying Out Forms - QFormLayout

Part II: The Qt Widgets Toolkit›

  • 4. Display Widgets
    • 4.1 Displaying Text with QLabel
    • 4.2 Displaying Images with QLabel
    • 4.3 Displaying LCD-like Numbers with QLCDNumber
    • 4.4 Displaying Progress with QProgressBar
  • 5. Buttons
    • 5.1 QPushButton - Triggering an Action
    • 5.2 Checkable QPushButton - Persistent On/Off State
    • 5.3 QCheckBox - Independent Options
    • 5.4 QRadioButton - Mutually Exclusive Choices
    • 5.5 QButtonGroup - Managing Groups Explicitly
  • 6. Numeric Widgets
    • 6.1 QSpinBox
    • 6.2 QDoubleSpinBox
    • 6.3 QSlider
    • 6.4 QDial
  • 7. Text Widgets
    • 7.1 QLineEdit
    • 7.2 QTextEdit
    • 7.3 QPlainTextEdit
  • 8. List Widgets
    • 8.1 QComboBox
    • 8.2 QListWidget
    • 8.3 QListView
  • 9. Table Widgets
    • 9.1 QTableWidget
    • 9.2 QTableView
  • 10. Tree Widgets
    • 10.1 QTreeWidget
    • 10.2 QTreeView
    • 10.3 Lazy-loading Trees
  • 11. Containers
    • 11.1 QGroupBox
    • 11.2 QScrollArea
    • 11.3 QToolBox
    • 11.4 QTabWidget
    • 11.5 QSplitter
    • 11.6 Choosing a Container
  • 12. Main Windows
    • 12.1 Setting Up the Central Widget
    • 12.2 Adding a Status Bar
    • 12.3 Creating Menus and Actions
    • 12.4 Adding Toolbars
    • 12.5 Using Dock Widgets
  • 13. Dialogs
    • 13.1 Standard Message Dialogs with QMessageBox
    • 13.2 Input Dialogs with QInputDialog
    • 13.3 File Dialogs with QFileDialog
    • 13.4 Color Selection with QColorDialog
    • 13.5 Font Selection with QFontDialog
    • 13.6 Creating Custom Dialogs by Subclassing QDialog
  • 14. Customizing Qt Styles
  • 15. Qt Style Sheets - QSS
    • 15.1 Selector Types
    • 15.2 Properties
    • 15.3 Pseudo-States
    • 15.4 Subcontrols
    • 15.5 The Box Model
  • 16. Creating Custom Widgets
    • 16.1 Subclassing QWidget - The Minimal TagBar
    • 16.2 Drawing Tags with QPainter and paintEvent()
    • 16.3 Handling Events
    • 16.4 Flow Layout, Size Hints, and Layout Integration

Part III: The Qt Object Model›

  • 17. Object Trees and Ownership
    • 17.1 Parent-Child Relationships
    • 17.2 Reparenting Qt Objects
    • 17.3 Finding Qt Object Children
    • 17.4 Manual Ownership Transfer
    • 17.5 Automatic Deletion
  • 18. Signals & Slots in Detail
    • 18.1 A Common Pitfall
    • 18.2 Custom Signals
    • 18.3 Signal Blocking
    • 18.4 Connection Objects
    • 18.5 Connecting Multiple Slots with a Signal
    • 18.6 Disconnecting
  • 19. Events
    • 19.1 Event Handlers
    • 19.2 Object Event Filters
    • 19.3 Application-Wide (Global) Event Filters
    • 19.4 Event Propagation
    • 19.5 Custom Events
    • 19.6 Event Delivery Order
  • 20. Timers
    • 20.1 Single-Shot Timers
    • 20.2 Starting and Stopping a Timer
    • 20.3 Adjusting a Timer Interval
    • 20.4 Countdown Timer
    • 20.5 Stopwatch
  • 21. Properties
    • 21.1 Declaring Basic Properties
    • 21.2 Properties Notification and Reset
    • 21.3 Constant and Non-Stored Properties
    • 21.4 Dynamic Properties for Validation-Based Styling
    • 21.5 Animating Custom Properties
    • 21.6 Inspecting Properties with QMetaObject

Part IV: Model-View Programming›

  • 22. QAbstractListModel
    • 22.1 Read-only List Model
    • 22.2 Editable List Model
    • 22.3 Data-Widget Mapping
    • 22.4 Resizable List Model
  • 23. QAbstractTableModel
    • 23.1 Basic Read-Only Table Model
    • 23.2 Making the Table Model Editable
    • 23.3 Using Data Widget Mapper with Table Models
    • 23.4 Resizable Table Model
  • 24. QAbstractItemModel
    • 24.1 Basic Read-Only Single-Column Tree Model
    • 24.2 Adding Multiple Columns to the Tree Model
    • 24.3 Making the Tree Model Editable
    • 24.4 Resizable Tree Model (Inserting and Removing Nodes)
    • 24.5 Minimum Methods to Implement by Model Type
    • 24.6 Choosing the Right Model and the Right View
  • 25. Delegates
    • 25.1 Using Item Data Roles to Customize Display
    • 25.2 Registering Standard Widgets with QItemEditorFactory
    • 25.3 Registering Custom Widgets with QItemEditorFactory
    • 25.4 Custom Display in QStyledItemDelegate
    • 25.5 Custom Editors in QStyledItemDelegate
    • 25.6 Combining Display and Editing in Delegates
    • 25.7 Persistent Editors in Views
  • 26. Sorting, Filtering and Selection
    • 26.1 Implementing In-Place Sorting in Custom Models
    • 26.2 Non-Destructive Sorting in Custom Models
    • 26.3 Automatic Sorting on Data Changes
    • 26.4 Sorting with Proxy Models
    • 26.5 Basic Filtering with Proxy Models
    • 26.6 Custom Filtering in Proxy Models
    • 26.7 Selection Modes and Behaviors
    • 26.8 Responding to Selection Changes
    • 26.9 Sharing Selection Models Between Views
    • 26.10 Custom Selection Handling

Part V: Multithreading›

  • 27. Worker Objects and moveToThread
    • 27.1 Blocking the Qt GUI: How Not to Do It
    • 27.2 A Minimal Working Example
    • 27.3 Walking the Filesystem
    • 27.4 Reusing the QThread object
    • 27.5 Walking the Filesystem While Reusing the QThread
    • 27.6 Signals and Slots Across Threads
  • 28. Subclassing QThread
    • 28.1 A Minimal Example
    • 28.2 Walking the Filesystem
  • 29. QThreadPool and QRunnable
    • 29.1 A Minimal Example
    • 29.2 Walking the Filesystem
  • 30. Thread Synchronization
    • 30.1 Race Condition Demo
    • 30.2 Queued Signal-Slot Connection
    • 30.3 QMutex
    • 30.4 QMutexLocker
    • 30.5 QSemaphore
    • 30.6 QSemaphoreReleaser
    • 30.7 QWaitCondition
  • 31 More Timers
  • 32. Signals & Slots Connection Types
    • 32.1 Direct Connection
    • 32.2 Queued Connection
    • 32.3 Blocking Queued Connection

Part VI: Special Topics›

  • 33. Databases
    • 33.1 Database Connections
    • 33.2 Executing Simple Queries
    • 33.3 Inserting Data
    • 33.4 Displaying and Editing Data with QSqlTableModel
    • 33.5 Handling Relational Data with QSqlRelationalTableModel
    • 33.6 Custom Queries with QSqlQueryModel
    • 33.7 The Single Record Form
    • 33.8 The Master-Detail Form
  • 34. Processes
    • 34.1 Basic Process Execution
    • 34.2 Providing Fixed Input to a Process
    • 34.3 Handling Chunked Output: A Common Pitfall
    • 34.4 Interactive Process Communication
    • 34.5 Setting Process Environment
    • 34.6 Synchronous Process Execution
    • 34.7 Terminating Processes
  • 35. Graphics View Framework
    • 35.1 The Canvas: QGraphicsScene and QGraphicsView
    • 35.2 Populating the Board: Built-in Graphics Items
    • 35.3 A Proper Note: Custom QGraphicsItem Painting
    • 35.4 Picking Up Notes: Interaction and Events
    • 35.5 Scaling Notes: Item Transformations
  • 36. Animation Framework
    • 36.1 QPropertyAnimation Basics
    • 36.2 Animating Color, Geometry, and Opacity
    • 36.3 Easing Curves
    • 36.4 Sequential Animation Groups
    • 36.5 Parallel Animation Groups
    • 36.6 Pause Animations
  • Appendix C - PySide6 Tools Reference
  • Appendix E - PySide6 Modules
  • Appendix F - Grouping Input Widgets by Data Type
PySide6 Blueprints/Part III: The Qt Object Model

Part III: The Qt Object Model

Qt’s object system - parent-child ownership, event handling, timers, and the property system. These chapters look into how Qt manages memory, dispatches events, and exposes object state.

Previous

16. Creating Custom Widgets

Up next

17. Object Trees and Ownership

In this part

  • 17. Object Trees and Ownership
  • 17.1 Parent-Child Relationships
  • 17.2 Reparenting Qt Objects
  • 17.3 Finding Qt Object Children
  • 17.4 Manual Ownership Transfer
  • 17.5 Automatic Deletion
  • 18. Signals & Slots in Detail
  • 18.1 A Common Pitfall
  • 18.2 Custom Signals
  • 18.3 Signal Blocking
  • 18.4 Connection Objects
  • 18.5 Connecting Multiple Slots with a Signal
  • 18.6 Disconnecting
  • 19. Events
  • 19.1 Event Handlers
  • 19.2 Object Event Filters
  • 19.3 Application-Wide (Global) Event Filters
  • 19.4 Event Propagation
  • 19.5 Custom Events
  • 19.6 Event Delivery Order
  • 20. Timers
  • 20.1 Single-Shot Timers
  • 20.2 Starting and Stopping a Timer
  • 20.3 Adjusting a Timer Interval
  • 20.4 Countdown Timer
  • 20.5 Stopwatch
  • 21. Properties
  • 21.1 Declaring Basic Properties
  • 21.2 Properties Notification and Reset
  • 21.3 Constant and Non-Stored Properties
  • 21.4 Dynamic Properties for Validation-Based Styling
  • 21.5 Animating Custom Properties
  • 21.6 Inspecting Properties with QMetaObject