{"id":3238,"library":"pyside6-essentials","title":"PySide6 Essentials","description":"PySide6 Essentials (version 6.11.0) provides the core Python bindings for the Qt 6 cross-platform application and UI framework. Developed by The Qt Company, it offers essential Qt modules like QtCore, QtGui, and QtWidgets under an LGPLv3 or GPLv2/GPLv3 license. It is released frequently, generally following the Qt framework's release cadence, with minor updates and bug fixes.","status":"active","version":"6.11.0","language":"en","source_language":"en","source_url":"https://github.com/qtproject/pyside-pyside-setup","tags":["GUI","Qt","UI","desktop","cross-platform"],"install":[{"cmd":"pip install pyside6-essentials","lang":"bash","label":"Install PySide6 Essentials"}],"dependencies":[],"imports":[{"symbol":"QApplication","correct":"from PySide6.QtWidgets import QApplication"},{"symbol":"QWidget","correct":"from PySide6.QtWidgets import QWidget"},{"symbol":"QLabel","correct":"from PySide6.QtWidgets import QLabel"},{"symbol":"QPushButton","correct":"from PySide6.QtWidgets import QPushButton"},{"symbol":"QMainWindow","correct":"from PySide6.QtWidgets import QMainWindow"},{"symbol":"QVBoxLayout","correct":"from PySide6.QtWidgets import QVBoxLayout"},{"symbol":"Qt","correct":"from PySide6.QtCore import Qt"},{"note":"QAction moved from QtWidgets to QtGui in PySide6 from PySide2.","wrong":"from PySide6.QtWidgets import QAction","symbol":"QAction","correct":"from PySide6.QtGui import QAction"}],"quickstart":{"code":"import sys\nfrom PySide6.QtWidgets import QApplication, QLabel, QWidget, QVBoxLayout\n\ndef main():\n    app = QApplication(sys.argv)\n    window = QWidget()\n    window.setWindowTitle(\"PySide6 Essentials App\")\n\n    layout = QVBoxLayout()\n    label = QLabel(\"Hello from PySide6 Essentials!\")\n    layout.addWidget(label)\n    window.setLayout(layout)\n\n    window.show()\n    sys.exit(app.exec())\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"A minimal PySide6 application demonstrating how to create a basic window with a label. It initializes QApplication, creates a QWidget as the main window, adds a QLabel, sets a layout, and starts the event loop."},"warnings":[{"fix":"Update all `from PySide2.<module> import ...` statements to `from PySide6.<module> import ...`.","message":"When migrating from PySide2, the main module name changed from `PySide2` to `PySide6`. All imports must reflect this change.","severity":"breaking","affected_versions":"All versions migrating from PySide2 to PySide6"},{"fix":"Change `from PySide6.QtWidgets import QAction` to `from PySide6.QtGui import QAction`.","message":"The `QAction` class was moved from `PySide6.QtWidgets` to `PySide6.QtGui` in PySide6 compared to PySide2.","severity":"breaking","affected_versions":"All versions migrating from PySide2 to PySide6"},{"fix":"Replace `event.pos().x()` with `event.position().x()` and `event.globalPos().x()` with `event.globalPosition().x()`.","message":"The `pos()` and `globalPos()` methods on `QMouseEvent` are deprecated. They now return `QPointF` objects via `position()` and `globalPosition()`.","severity":"gotcha","affected_versions":"PySide6 (from PySide2)"},{"fix":"Replace calls to `layout.setMargin(...)` with `layout.setContentsMargins(left, top, right, bottom)` or `layout.setContentsMargins(QMargins(left, top, right, bottom))`.","message":"The `QLayout.setMargin()` method has been removed. Use `QLayout.setContentsMargins()` instead.","severity":"gotcha","affected_versions":"PySide6 (from PySide2)"},{"fix":"Use the full path for enums and flags: e.g., `Qt.AlignmentFlag.AlignLeft` instead of `Qt.AlignLeft`.","message":"For better compatibility with PyQt6 (which enforces fully qualified names), prefer using fully qualified enum names like `Qt.ItemDataRole.DisplayRole` instead of shorter forms like `Qt.DisplayRole`, even though PySide6 supports both.","severity":"gotcha","affected_versions":"PySide6 (especially for cross-library compatibility)"},{"fix":"It is recommended to first `pip uninstall pyside6 pyside6-essentials pyside6-addons shiboken6` and then `pip install pyside6` to ensure a clean installation of the new modular structure.","message":"When upgrading PySide6 from versions 6.2.x to 6.3 or newer, issues may arise due to the packaging split into `pyside6-essentials` and `pyside6-addons`. A direct `pip install --upgrade` might not correctly update the dependencies.","severity":"gotcha","affected_versions":"6.2.x to 6.3+"},{"fix":"Add `from __feature__ import snake_case, true_property` at the top of your Python file to enable these Pythonic conventions.","message":"By default, PySide6 uses `camelCase` for methods and properties, consistent with C++ Qt. To use `snake_case` (PEP8 compliant) and direct property access, you must import them from `__feature__`.","severity":"gotcha","affected_versions":"All PySide6 versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}