The script below works fine in 4.1.0.3 but results in a "Process finished with exit code -1073741819 (0xC0000005)" after upgrading to 4.2.1 (PySide6-Essentials-6.6.2 PySide6-qtads-4.2.1 shiboken6-6.6.2)
Env:
Python 3.11
Windows 11
Not sure if this is PySide6QtAds related or QtAds. Tried to reproduce in PyQtAds but that package on pip is still at version 3.8.1 so no luck there.
"""Demo / Test file for auto hide docks in PySide6QtAds.
A custom close event is added to the docks to make them return to the hidden state when the close button is pressed.
"""
from PySide6 import QtWidgets
import PySide6QtAds
VERSION = "4.2.1" # __version__ is not available
if VERSION == "4.2.1":
LOCATION = PySide6QtAds.ads.SideBarLocation.SideBarRight
else:
LOCATION = PySide6QtAds._ads.SideBarLocation.SideBarRight
def create_dock_manager(main_window):
# auto-hide icons
if VERSION == "4.2.1":
# 4.2.1
PySide6QtAds.CDockManager.setAutoHideConfigFlags(
PySide6QtAds.ads.CDockManager.eAutoHideFlag.AutoHideSideBarsIconOnly
)
else:
# < 4.2.1
PySide6QtAds.CDockManager.setAutoHideConfigFlag(
PySide6QtAds.CDockManager.DefaultAutoHideConfig
)
PySide6QtAds.CDockManager.setAutoHideConfigFlag(
PySide6QtAds.CDockManager.AutoHideSideBarsIconOnly, True
)
dock_manager = PySide6QtAds.CDockManager(main_window)
dock_manager.setConfigFlag(PySide6QtAds.CDockManager.ActiveTabHasCloseButton, False)
return dock_manager
def set_as_central_widget(
dock_manager: PySide6QtAds.CDockManager, widget: QtWidgets.QWidget
):
central_dock_widget = PySide6QtAds.CDockWidget("CentralWidget")
central_dock_widget.setWidget(widget)
central_dock_area = dock_manager.setCentralWidget(central_dock_widget)
central_dock_widget.setFeature(PySide6QtAds.CDockWidget.DockWidgetClosable, False)
central_dock_area.setAllowedAreas(PySide6QtAds.DockWidgetArea.OuterDockAreas)
return central_dock_widget
#
def _dock_return_to_hidden_state(d: PySide6QtAds.CDockWidget):
"""Triggers visibility (making it invisible) and then places it in the right sidebar."""
d.toggleViewAction().trigger() # removes the dock from the gui
manager = d.dockManager()
manager.addAutoHideDockWidget(LOCATION, d)
def add_global_dock(
manager: PySide6QtAds.CDockManager,
d: PySide6QtAds.CDockWidget,
):
"""Adds a dock to the manager and make it a 'global' dock.
Global docks are docks that can not be closed and are hidden on the top right by default.
"""
assert isinstance(d, PySide6QtAds.CDockWidget)
#
container = manager.addAutoHideDockWidget(
LOCATION, d
)
d.setFeature(PySide6QtAds.CDockWidget.DockWidgetFeature.CustomCloseHandling, True)
d.closeRequested.connect(lambda dock=d: _dock_return_to_hidden_state(dock))
container.setSize(350)
return d
if __name__ == "__main__":
from PySide6.QtWidgets import (
QApplication,
QMainWindow,
QLabel,
)
app = QApplication()
mw = QMainWindow()
dock_manager = create_dock_manager(mw)
# create the central widget dock
main_widget = QLabel("Main Widget")
main_widget.setStyleSheet("background-color: lightblue;")
central_dock = PySide6QtAds.CDockWidget("Central Dock", mw)
central_dock.setWidget(main_widget)
central_dock_area = dock_manager.setCentralWidget(central_dock)
central_dock_area.setAllowedAreas(PySide6QtAds.DockWidgetArea.OuterDockAreas)
# create an un-closable dock on the right size
global_widget1 = QLabel("Global widget 1")
global_widget1.setStyleSheet("background-color: lightyellow;")
global_dock1 = PySide6QtAds.CDockWidget("Global Dock 1", mw)
global_dock1.setWidget(global_widget1)
d = add_global_dock(dock_manager, global_dock1) #<-- Process finished with exit code -1073741819 (0xC0000005)
mw.show()
app.exec()
The script below works fine in 4.1.0.3 but results in a "Process finished with exit code -1073741819 (0xC0000005)" after upgrading to 4.2.1 (PySide6-Essentials-6.6.2 PySide6-qtads-4.2.1 shiboken6-6.6.2)
Env:
Python 3.11
Windows 11
Not sure if this is PySide6QtAds related or QtAds. Tried to reproduce in PyQtAds but that package on pip is still at version 3.8.1 so no luck there.