You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The autogenerated type stubs are also useful for understanding the API.
Minimal Example
fromPyQt6.QtCoreimportQtfromPyQt6.QtGuiimportQActionfromPyQt6.QtWidgetsimportQMainWindow, QLabelimportPyQt6AdsasadsclassMainWindow(QMainWindow):
def__init__(self) ->None:
super().__init__()
# create the dock manager# If the parent is a QMainWindow, DockManager sets itself as the central widget.self.dock_manager=ads.CDockManager(self)
# create an example widget to place inside the dock widgetlbl=QLabel()
lbl.setWordWrap(True)
lbl.setAlignment(Qt.AlignmentFlag.AlignTop|Qt.AlignmentFlag.AlignLeft)
lbl.setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.")
# create a dock widget with the title "Label 1"# and set the created label as the dock widget contentdw=ads.CDockWidget("Label 1")
dw.setWidget(lbl)
# add the toggleViewAction of the dock widget to the menu# to give the user the possibility to show the dock widget if it has been closedself.menuView=self.menuBar().addMenu("View")
self.menuView.addAction(dw.toggleViewAction())
# add the dock widget to the top dock widget areaself.dock_manager.addDockWidget(ads.DockWidgetArea.TopDockWidgetArea, dw)