API Documentation¶
qtpydocking.dock_area_layout¶
qtpydocking.dock_area_tab_bar¶
-
class
qtpydocking.dock_area_tab_bar.
DockAreaTabBar
(parent: QWidget = None)[source]¶ Bases:
PyQt5.QtWidgets.QScrollArea
-
close_tab
(index: int)[source]¶ This function will close the tab given in Index param. Closing a tab means, the tab will be hidden, it will not be removed
- Parameters
- indexint
-
current_index
() → int[source]¶ Returns the current index or -1 if no tab is selected
- Returns
- valueint
-
current_tab
() → Optional[qtpydocking.dock_widget_tab.DockWidgetTab][source]¶ Returns the current tab or a nullptr if no tab is selected.
- Returns
- valueDockWidgetTab
-
eventFilter
(tab: PyQt5.QtCore.QObject, event: PyQt5.QtCore.QEvent) → bool[source]¶ Filters the tab widget events
- Parameters
- tabQObject
- eventQEvent
- Returns
- valuebool
-
insert_tab
(index: int, tab: qtpydocking.dock_widget_tab.DockWidgetTab)[source]¶ Inserts the given dock widget tab at the given position. Inserting a new tab at an index less than or equal to the current index will increment the current index, but keep the current tab.
- Parameters
- indexint
- tabDockWidgetTab
-
is_tab_open
(index: int) → bool[source]¶ This function returns true if the tab is open, that means if it is visible to the user. If the function returns false, the tab is closed
- Parameters
- indexint
- Returns
- valuebool
-
make_area_floating
(offset: PyQt5.QtCore.QPoint, drag_state: qtpydocking.enums.DragState) → qtpydocking.floating_dock_container.FloatingDockContainer[source]¶ Makes the dock area floating
- Parameters
- offsetQPoint
- drag_stateDragState
- Returns
- valueFloatingDockContainer
-
mouseDoubleClickEvent
(event: PyQt5.QtGui.QMouseEvent)[source]¶ Double clicking the title bar also starts floating of the complete area
- Parameters
- eventQMouseEvent
-
mouseMoveEvent
(ev: PyQt5.QtGui.QMouseEvent)[source]¶ Starts floating the complete docking area including all dock widgets, if it is not the last dock area in a floating widget
- Parameters
- evQMouseEvent
-
mousePressEvent
(ev: PyQt5.QtGui.QMouseEvent)[source]¶ Stores mouse position to detect dragging
- Parameters
- evQMouseEvent
-
mouseReleaseEvent
(ev: PyQt5.QtGui.QMouseEvent)[source]¶ Stores mouse position to detect dragging
- Parameters
- evQMouseEvent
-
on_tab_widget_moved
(global_pos: PyQt5.QtCore.QPoint)[source]¶ On tab widget moved
- Parameters
- global_posQPoint
-
remove_tab
(tab: qtpydocking.dock_widget_tab.DockWidgetTab)[source]¶ Removes the given DockWidgetTab from the tabbar
- Parameters
- tabDockWidgetTab
-
set_current_index
(index: int)[source]¶ This property sets the index of the tab bar’s visible tab
- Parameters
- indexint
-
tab
(index: int) → Optional[qtpydocking.dock_widget_tab.DockWidgetTab][source]¶ Returns the tab with the given index
- Parameters
- indexint
- Returns
- valueDockWidgetTab
-
qtpydocking.dock_area_title_bar¶
-
class
qtpydocking.dock_area_title_bar.
DockAreaTitleBar
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QFrame
Returns the button corresponding to the given title bar button identifier
- Parameters
- whichTitleBarButton
- Returns
- valueQAbstractButton
On tabs menu action triggered
- Parameters
- actionQAction
Show context menu
- Parameters
- posQPoint
qtpydocking.dock_area_widget¶
-
class
qtpydocking.dock_area_widget.
DockAreaWidget
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QFrame
-
add_dock_widget
(dock_widget: DockWidget)[source]¶ Add a new dock widget to dock area. All dockwidgets in the dock area tabified in a stacked layout with tabs
- Parameters
- dock_widgetDockWidget
-
content_area_geometry
() → PyQt5.QtCore.QRect[source]¶ Returns the rectangle of the content
- Returns
- valueQRect
-
current_dock_widget
() → Optional[DockWidget][source]¶ Returns the current active dock widget or a nullptr if there is no active dock widget (i.e. if all dock widgets are closed)
- Returns
- valueDockWidget
-
current_index
() → int[source]¶ Returns the index of the current active dock widget or -1 if there are is no active dock widget (ie.e if all dock widgets are closed)
- Returns
- valueint
-
dock_container
() → DockContainerWidget[source]¶ Returns the dock container widget this dock area widget belongs to or 0 if there is no
- Returns
- valueDockContainerWidget
-
dock_manager
() → DockManager[source]¶ Returns the dock manager object this dock area belongs to
- Returns
- valueDockManager
-
dock_widget
(index: int) → DockWidget[source]¶ Returns a dock widget by its index
- Parameters
- indexint
- Returns
- valueDockWidget
-
dock_widgets
() → list[source]¶ Returns a list of all dock widgets in this dock area. This list contains open and closed dock widgets.
- Returns
- valuelist of DockWidget
-
dock_widgets_count
() → int[source]¶ Returns the number of dock widgets in this area
- Returns
- valueint
-
features
() → qtpydocking.enums.DockWidgetFeature[source]¶ This functions returns the dock widget features of all dock widget in this area. A bitwise and is used to combine the flags of all dock widgets. That means, if only dock widget does not support a certain flag, the whole dock are does not support the flag.
- Returns
- valueDockWidgetFeature
-
hide_area_with_no_visible_content
()[source]¶ Call this function, if you already know, that the dock does not contain any visible content (any open dock widgets).
-
index
(dock_widget: DockWidget) → int[source]¶ Returns the index of the given DockWidget in the internal layout
- Parameters
- dock_widgetDockWidget
- Returns
- valueint
-
index_of_first_open_dock_widget
() → int[source]¶ Returns the index of the first open dock widgets in the list of dock widgets.
This function is here for performance reasons. Normally it would be possible to take the first dock widget from the list returned by openedDockWidgets() function. But that function enumerates all dock widgets while this functions stops after the first open dock widget. If there are no open dock widgets, the function returns -1.
- Returns
- valueint
-
insert_dock_widget
(index: int, dock_widget: DockWidget, activate: bool = True)[source]¶ Inserts a dock widget into dock area.
All dockwidgets in the dock area tabified in a stacked layout with tabs. The index indicates the index of the new dockwidget in the tabbar and in the stacked layout. If the Activate parameter is true, the new DockWidget will be the active one in the stacked layout
- Parameters
- indexint
- dock_widgetDockWidget
- activatebool, optional
-
internal_set_current_dock_widget
(dock_widget: DockWidget)[source]¶ This is the internal private function for setting the current widget. This function is called by the public setCurrentDockWidget() function and by the dock manager when restoring the state
- Parameters
- dock_widgetDockWidget
Marks tabs menu to update
-
next_open_dock_widget
(dock_widget: DockWidget) → Optional[DockWidget][source]¶ This is a helper function to get the next open dock widget to activate if the given DockWidget will be closed or removed. The function returns the next widget that should be activated or nullptr in case there are no more open widgets in this area.
- Parameters
- dock_widgetDockWidget
- Returns
- valueDockWidget
-
open_dock_widgets_count
() → int[source]¶ Returns the number of dock widgets in this area
- Returns
- valueint
-
opened_dock_widgets
() → list[source]¶ Returns a list of dock widgets that are not closed
- Returns
- valuelist of DockWidget
-
remove_dock_widget
(dock_widget: DockWidget)[source]¶ Removes the given dock widget from the dock area
- Parameters
- dock_widgetDockWidget
-
reorder_dock_widget
(from_index: int, to_index: int)[source]¶ Reorder the index position of DockWidget at fromIndx to toIndex if a tab in the tabbar is dragged from one index to another one
- Parameters
- from_indexint
- to_indexint
-
save_state
(stream: PyQt5.QtCore.QXmlStreamWriter)[source]¶ Saves the state into the given stream
- Parameters
- streamQXmlStreamWriter
-
setVisible
(visible: bool)[source]¶ Update the close button if visibility changed
- Parameters
- visiblebool
-
set_current_dock_widget
(dock_widget: DockWidget)[source]¶ Shows the tab with the given dock widget
- Parameters
- dock_widgetDockWidget
-
set_current_index
(index: int)[source]¶ This activates the tab for the given tab index. If the dock widget for the given tab is not visible, the this function call will make it visible.
- Parameters
- indexint
Returns the title bar button corresponding to the given title bar button identifier
- Parameters
- whichTitleBarButton
- Returns
- valueQAbstractButton
-
title_bar_geometry
() → PyQt5.QtCore.QRect[source]¶ Returns the rectangle of the title area
- Returns
- valueQRect
-
qtpydocking.dock_container_widget¶
-
class
qtpydocking.dock_container_widget.
DockContainerWidget
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QFrame
-
add_dock_area
(dock_area_widget: qtpydocking.dock_area_widget.DockAreaWidget, area: qtpydocking.enums.DockWidgetArea = <DockWidgetArea.center: 16>)[source]¶ Adds the given dock area to this container widget
- Parameters
- dock_area_widgetDockAreaWidget
- areaDockWidgetArea
-
add_dock_widget
(area: qtpydocking.enums.DockWidgetArea, dockwidget: DockWidget, dock_area_widget: qtpydocking.dock_area_widget.DockAreaWidget = None) → qtpydocking.dock_area_widget.DockAreaWidget[source]¶ Adds dockwidget into the given area. If DockAreaWidget is not null, then the area parameter indicates the area into the DockAreaWidget. If DockAreaWidget is null, the Dockwidget will be dropped into the container.
- Parameters
- areaDockWidgetArea
- dockwidgetDockWidget
- dock_area_widgetDockAreaWidget
- Returns
- valueDockAreaWidget
-
close_other_areas
(keep_open_area: qtpydocking.dock_area_widget.DockAreaWidget)[source]¶ Call this function to close all dock areas except the KeepOpenArea
- Parameters
- keep_open_areaDockAreaWidget
-
dock_area
(index: int) → qtpydocking.dock_area_widget.DockAreaWidget[source]¶ Returns the dock area at the given Index or 0 if the index is out of range
- Parameters
- indexint
- Returns
- valueDockAreaWidget
-
dock_area_at
(global_pos: PyQt5.QtCore.QPoint) → qtpydocking.dock_area_widget.DockAreaWidget[source]¶ Returns the dock area at teh given global position or 0 if there is no dock area at this position
- Parameters
- global_posQPoint
- Returns
- valueDockAreaWidget
-
dock_area_count
() → int[source]¶ Returns the number of dock areas in this container
- Returns
- valueint
-
dock_widgets
() → list[source]¶ This function returns a list of all dock widgets in this floating widget. It may be possible, depending on the implementation, that dock widgets, that are not visible to the user have no parent widget. Therefore simply calling findChildren() would not work here. Therefore this function iterates over all dock areas and creates a list that contains all dock widgets returned from all dock areas.
- Returns
- valuelist
-
drop_floating_widget
(floating_widget: FloatingDockContainer, target_pos: PyQt5.QtCore.QPoint)[source]¶ Drop floating widget into the container
- Parameters
- floating_widgetFloatingDockContainer
- target_posQPoint
-
event
(e: PyQt5.QtCore.QEvent) → bool[source]¶ Handles activation events to update zOrderIndex
- Parameters
- eQEvent
- Returns
- valuebool
-
features
() → qtpydocking.enums.DockWidgetFeature[source]¶ This functions returns the dock widget features of all dock widget in this container. A bitwise and is used to combine the flags of all dock widgets. That means, if only dock widget does not support a certain flag, the whole dock are does not support the flag.
- Returns
- valueDockWidgetFeature
-
floating_widget
() → FloatingDockContainer[source]¶ If this dock container is in a floating widget, this function returns the floating widget. Else, it returns a nullptr.
- Returns
- valueFloatingDockContainer
-
has_top_level_dock_widget
() → bool[source]¶ This function returns true if this dock area has only one single visible dock widget. A top level widget is a real floating widget. Only the isFloating() function of top level widgets may returns true.
- Returns
- valuebool
-
is_floating
() → bool[source]¶ This function returns true, if this container is in a floating widget
- Returns
- valuebool
-
is_in_front_of
(other: qtpydocking.dock_container_widget.DockContainerWidget) → bool[source]¶ This function returns true if this container widgets z order index is higher than the index of the container widget given in Other parameter
- Parameters
- otherDockContainerWidget
- Returns
- valuebool
-
last_added_dock_area_widget
(area: qtpydocking.enums.DockWidgetArea) → qtpydocking.dock_area_widget.DockAreaWidget[source]¶ This function returns the last added dock area widget for the given area identifier or 0 if no dock area widget has been added for the given area
- Parameters
- areaDockWidgetArea
- Returns
- valueDockAreaWidget
-
opened_dock_areas
() → list[source]¶ Returns the list of dock areas that are not closed If all dock widgets in a dock area are closed, the dock area will be closed
- Returns
- valuelist
-
remove_dock_area
(area: qtpydocking.dock_area_widget.DockAreaWidget)[source]¶ Removes the given dock area from this container
- Parameters
- areaDockAreaWidget
-
remove_dock_widget
(widget: DockWidget)[source]¶ Removes a given DockWidget
- Parameters
- widgetDockWidget
-
restore_state
(stream: PyQt5.QtCore.QXmlStreamReader, testing: bool = False) → bool[source]¶ Restores the state from given stream.
- Parameters
- streamQXmlStreamReader
- testingbool
If Testing is true, the function only parses the data from the given stream but does not restore anything. You can use this check for faulty files before you start restoring the state
- Returns
- valuebool
-
root_splitter
() → PyQt5.QtWidgets.QSplitter[source]¶ Access function for the internal root splitter
- Returns
- valueQSplitter
-
save_state
(stream: PyQt5.QtCore.QXmlStreamWriter)[source]¶ Saves the state into the given stream
- Parameters
- streamQXmlStreamWriter
-
top_level_dock_area
() → qtpydocking.dock_area_widget.DockAreaWidget[source]¶ Returns the top level dock area.
- Returns
- valueDockAreaWidget
-
-
qtpydocking.dock_container_widget.
dock_area_insert_parameters
(area: qtpydocking.enums.DockWidgetArea) → qtpydocking.enums.DockInsertParam[source]¶ Returns the insertion parameters for the given dock area
- Parameters
- areaDockWidgetArea
- Returns
- valueDockInsertParam
qtpydocking.dock_manager¶
-
class
qtpydocking.dock_manager.
DockManager
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
qtpydocking.dock_container_widget.DockContainerWidget
-
add_dock_widget
(area: qtpydocking.enums.DockWidgetArea, dock_widget: DockWidget, dock_area_widget: DockAreaWidget = None) → DockAreaWidget[source]¶ Adds dock_widget into the given area. If DockAreaWidget is not null, then the area parameter indicates the area into the DockAreaWidget. If DockAreaWidget is null, the Dockwidget will be dropped into the container. If you would like to add a dock widget tabified, then you need to add it to an existing dock area object into the CenterDockWidgetArea. The following code shows this:
- Parameters
- areaDockWidgetArea
- dock_widgetDockWidget
- dock_area_widgetDockAreaWidget, optional
- Returns
- valueDockAreaWidget
-
add_dock_widget_tab
(area: qtpydocking.enums.DockWidgetArea, dockwidget: DockWidget) → DockAreaWidget[source]¶ This function will add the given Dockwidget to the given dock area as a new tab. If no dock area widget exists for the given area identifier, a new dock area widget is created.
- Parameters
- areaDockWidgetArea
- dockwidgetDockWidget
- Returns
- valueDockAreaWidget
-
add_dock_widget_tab_to_area
(dockwidget: DockWidget, dock_area_widget: DockAreaWidget) → DockAreaWidget[source]¶ This function will add the given Dockwidget to the given DockAreaWidget as a new tab.
- Parameters
- dockwidgetDockWidget
- dock_area_widgetDockAreaWidget
- Returns
- valueDockAreaWidget
-
add_perspective
(unique_perspective_name: str)[source]¶ Saves the current perspective to the internal list of perspectives. A perspective is the current state of the dock manager assigned with a certain name. This makes it possible for the user, to switch between different perspectives quickly. If a perspective with the given name already exists, then it will be overwritten with the new state.
- Parameters
- unique_perspective_namestr
Adds a toggle view action to the the internal view menu. You can either manage the insertion of the toggle view actions in your application or you can add the actions to the internal view menu and then simply insert the menu object into your.
- Parameters
- toggle_view_actionQAction
- groupstr
- group_iconQIcon
- Returns
- valueQAction
-
config_flags
() → qtpydocking.enums.DockFlags[source]¶ This function returns the global configuration flags
- Returns
- valueDockFlags
-
container_overlay
() → qtpydocking.dock_overlay.DockOverlay[source]¶ Overlay for containers
- Returns
- valueDockOverlay
-
dock_area_overlay
() → qtpydocking.dock_overlay.DockOverlay[source]¶ Overlay for dock areas
- Returns
- valueDockOverlay
-
dock_containers
() → list[source]¶ Returns the list of all active and visible dock containers
Dock containers are the main dock manager and all floating widgets.
- Returns
- valuelist
-
dock_widgets_map
() → dict[source]¶ This function returns a readable reference to the internal dock widgets map so that it is possible to iterate over all dock widgets
- Returns
- valuedict:
-
find_dock_widget
(object_name: str) → DockWidget[source]¶ Searches for a registered doc widget with the given ObjectName
- Parameters
- object_namestr
- Returns
- valueDockWidget
-
is_restoring_state
() → bool[source]¶ This function returns true between the restoringState() and stateRestored() signals.
- Returns
- valuebool
-
load_perspectives
(settings: PyQt5.QtCore.QSettings)[source]¶ Loads the perspectives from the given settings file
- Parameters
- settingsQSettings
-
open_perspective
(perspective_name: str)[source]¶ Opens the perspective with the given name.
- Parameters
- perspective_namestr
-
perspective_names
() → List[str][source]¶ Returns the names of all available perspectives
- Returns
- valuelist
-
register_dock_container
(dock_container: qtpydocking.dock_container_widget.DockContainerWidget)[source]¶ Registers the given dock container widget
- Parameters
- dock_containerDockContainerWidget
-
register_floating_widget
(floating_widget: qtpydocking.floating_dock_container.FloatingDockContainer)[source]¶ Registers the given floating widget in the internal list of floating widgets
- Parameters
- floating_widgetFloatingDockContainer
-
remove_dock_container
(dock_container: qtpydocking.dock_container_widget.DockContainerWidget)[source]¶ Remove dock container from the internal list of registered dock containers
- Parameters
- dock_containerDockContainerWidget
-
remove_dock_widget
(widget: DockWidget)[source]¶ Removes a given DockWidget
- Parameters
- widgetDockWidget
-
remove_floating_widget
(floating_widget: qtpydocking.floating_dock_container.FloatingDockContainer)[source]¶ Remove the given floating widget from the list of registered floating widgets
- Parameters
- floating_widgetFloatingDockContainer
-
remove_perspectives
(*names)[source]¶ Removes the given perspective(s) from the dock manager
- Parameters
- *namesstr
-
restore_state
(state: PyQt5.QtCore.QByteArray, version: int = 0) → bool[source]¶ Restores the state of this dockmanagers dockwidgets. The version number is compared with that stored in state. If they do not match, the dockmanager’s state is left unchanged, and this function returns false; otherwise, the state is restored, and this function returns true.
- Parameters
- stateQByteArray
- versionint
- Returns
- valuebool
-
save_perspectives
(settings: PyQt5.QtCore.QSettings)[source]¶ Saves the perspectives to the given settings file.
- Parameters
- settingsQSettings
-
save_state
(version: int = 0) → PyQt5.QtCore.QByteArray[source]¶ Saves the current state of the dockmanger and all its dock widgets into the returned QByteArray.
See also config_flags, which allow for auto-formatting and compression of the resulting XML file.
- Parameters
- versionint
- Returns
- valueQByteArray
-
set_config_flags
(flags: qtpydocking.enums.DockFlags)[source]¶ Sets the global configuration flags for the whole docking system. Call this function before you create your first dock widget.
- Parameters
- flagsDockFlags
Define the insertion order for toggle view menu items. The order defines how the actions are added to the view menu. The default insertion order is MenuAlphabeticallySorted to make it easier for users to find the menu entry for a certain dock widget. You need to call this function befor you insert the first menu item into the view menu.
- Parameters
- orderInsertionOrder
This function returns the internal view menu. To fill the view menu, you can use the addToggleViewActionToMenu() function.
- Returns
- valueQMenu
-
qtpydocking.dock_overlay¶
-
class
qtpydocking.dock_overlay.
DockOverlay
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QFrame
-
allowed_areas
() → qtpydocking.enums.DockWidgetArea[source]¶ Returns flags with all allowed drop areas
- Returns
- valueDockWidgetArea
-
drop_area_under_cursor
() → qtpydocking.enums.DockWidgetArea[source]¶ Returns the drop area under the current cursor location
- Returns
- valueDockWidgetArea
-
drop_overlay_rect
() → PyQt5.QtCore.QRect[source]¶ The drop overlay rectangle for the target area
- Returns
- valueQRect
-
enable_drop_preview
(enable: bool)[source]¶ Enables / disables the semi transparent overlay rectangle that represents the future area of the dropped widget
- Parameters
- enablebool
-
event
(e: PyQt5.QtCore.QEvent) → bool[source]¶ Handle polish events
- Parameters
- eQEvent
- Returns
- valuebool
-
set_allowed_areas
(areas: qtpydocking.enums.DockWidgetArea)[source]¶ Configures the areas that are allowed for docking
- Parameters
- areasDockWidgetArea
-
show_overlay
(target: PyQt5.QtWidgets.QWidget) → qtpydocking.enums.DockWidgetArea[source]¶ Show the drop overlay for the given target widget
- Parameters
- targetQWidget
- Returns
- valueDockWidgetArea
-
-
class
qtpydocking.dock_overlay.
DockOverlayCross
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QWidget
-
cursor_location
() → qtpydocking.enums.DockWidgetArea[source]¶ Returns the dock widget area depending on the current cursor location. The function checks, if the mouse cursor is inside of any drop indicator widget and returns the corresponding DockWidgetArea.
- Returns
- valueDockWidgetArea
-
icon_color
(color_index: qtpydocking.enums.IconColor) → PyQt5.QtGui.QColor[source]¶ Returns the icon color given by ColorIndex
- Parameters
- color_indexIconColor
- Returns
- valueQColor
-
set_area_widgets
(widgets: dict)[source]¶ Set area widgets
- Parameters
- widgetsdict
DockWidgetArea to QWidget
-
set_icon_arrow_color
(color: PyQt5.QtGui.QColor)[source]¶ Set icon arrow color
- Parameters
- colorQColor
-
set_icon_background_color
(color: PyQt5.QtGui.QColor)[source]¶ Set icon background color
- Parameters
- colorQColor
-
set_icon_color
(color_index: qtpydocking.enums.IconColor, color: PyQt5.QtGui.QColor)[source]¶ Sets a certain icon color
- Parameters
- color_indexIconColor
- colorQColor
-
set_icon_colors
(colors: str)[source]¶ A string with all icon colors to set. You can use this property to style the overly icon via CSS stylesheet file. The colors are set via a color identifier and a hex AARRGGBB value like in the example below.
- Parameters
- colorsstr
-
set_icon_frame_color
(color: PyQt5.QtGui.QColor)[source]¶ Set icon frame color
- Parameters
- colorQColor
-
set_icon_overlay_color
(color: PyQt5.QtGui.QColor)[source]¶ Set icon overlay color
- Parameters
- colorQColor
-
set_icon_shadow_color
(color: PyQt5.QtGui.QColor)[source]¶ Set icon shadow color
- Parameters
- colorQColor
-
setup_overlay_cross
(mode: qtpydocking.enums.OverlayMode)[source]¶ Sets up the overlay cross for the given overlay mode
- Parameters
- modeOverlayMode
-
qtpydocking.dock_splitter¶
qtpydocking.dock_widget¶
-
class
qtpydocking.dock_widget.
DockWidget
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QFrame
-
create_default_tool_bar
() → PyQt5.QtWidgets.QToolBar[source]¶ If you would like to use the default top tool bar, then call this function to create the default tool bar. After this function the toolBar() function will return a valid toolBar() object.
- Returns
- valueQToolBar
-
dock_area_widget
() → DockAreaWidget[source]¶ Returns the dock area widget this dock widget belongs to or 0 if this dock widget has not been docked yet
- Returns
- valueDockAreaWidget
-
dock_container
() → Optional[DockContainerWidget][source]¶ Returns the dock container widget this dock area widget belongs to or None if this dock widget has not been docked yet
- Returns
- valueDockContainerWidget
-
dock_manager
() → DockManager[source]¶ Returns the dock manager that manages the dock widget or 0 if the widget has not been assigned to any dock manager yet
- Returns
- valueDockManager
-
emit_top_level_changed
(floating: bool)[source]¶ Use this function to emit a top level changed event. Do never use emit top_level_changed(). Always use this function because it only emits a signal if the floating state has really changed
- Parameters
- floatingbool
-
event
(e: PyQt5.QtCore.QEvent) → bool[source]¶ Emits titleChanged signal if title change event occurs
- Parameters
- eQEvent
- Returns
- valuebool
-
features
() → qtpydocking.enums.DockWidgetFeature[source]¶ This property holds whether the dock widget is movable, closable, and floatable. By default, this property is set to a combination of DockWidgetClosable, DockWidgetMovable and DockWidgetFloatable.
- Returns
- valueDockWidgetFeature
-
flag_as_unassigned
()[source]¶ This is a helper function for the dock manager to flag this widget as unassigned. When calling the restore function, it may happen, that the saved state contains less dock widgets then currently available. All widgets whose data is not contained in the saved state, are flagged as unassigned after the restore process. If the user shows an unassigned dock widget, a floating widget will be created to take up the dock widget.
-
icon
() → PyQt5.QtGui.QIcon[source]¶ Returns the icon that has been assigned to the dock widget
- Returns
- valueQIcon
-
is_floating
() → bool[source]¶ This property holds whether the dock widget is floating. A dock widget is only floating, if it is the one and only widget inside of a floating container. If there are more than one dock widget in a floating container, the all dock widgets are docked and not floating.
- Returns
- valuebool
-
is_in_floating_container
() → bool[source]¶ This function returns true, if this dock widget is in a floating. The function returns true, if the dock widget is floating and it also returns true if it is docked inside of a floating container.
- Returns
- valuebool
-
minimumSizeHint
() → PyQt5.QtCore.QSize[source]¶ We return a fixed minimum size hint for all dock widgets
- Returns
- valueQSize
-
save_state
(stream: PyQt5.QtCore.QXmlStreamWriter)[source]¶ Saves the state into the given stream
- Parameters
- streamQXmlStreamWriter
-
set_closed_state
(closed: bool)[source]¶ Internal function for modifying the closed state when restoring a saved docking state
- Parameters
- closedbool
-
set_dock_area
(dock_area: DockAreaWidget)[source]¶ If this dock widget is inserted into a dock area, the dock area will be registered on this widget via this function. If a dock widget is removed from a dock area, this function will be called with nullptr value.
- Parameters
- dock_areaDockAreaWidget
-
set_dock_manager
(dock_manager: DockManager)[source]¶ Assigns the dock manager that manages this dock widget
- Parameters
- dock_managerDockManager
-
set_feature
(flag: qtpydocking.enums.DockWidgetFeature, on: bool = True)[source]¶ Sets the feature flag for this dock widget if on is true; otherwise clears the flag.
- Parameters
- flagDockWidgetFeature
- onbool
-
set_features
(features: qtpydocking.enums.DockWidgetFeature)[source]¶ Sets, whether the dock widget is movable, closable, and floatable.
- Parameters
- featuresDockWidgetFeature
-
set_icon
(icon: PyQt5.QtGui.QIcon)[source]¶ Sets the dock widget icon that is shown in tabs and in toggle view actions
- Parameters
- iconQIcon
-
set_tab_tool_tip
(text: str)[source]¶ This is function sets text tooltip for title bar widget and tooltip for toggle view action
- Parameters
- textstr
-
set_toggle_view_action_checked
(checked: bool)[source]¶ This function changes the toggle view action without emitting any signal
- Parameters
- checkedbool
-
set_toggle_view_action_mode
(mode: qtpydocking.enums.ToggleViewActionMode)[source]¶ Configures the behavior of the toggle view action.
- Parameters
- modeToggleViewActionMode
-
set_tool_bar
(tool_bar: PyQt5.QtWidgets.QToolBar)[source]¶ Assign a new tool bar that is shown above the content widget. The dock widget will become the owner of the tool bar and deletes it on destruction
- Parameters
- tool_barQToolBar
-
set_tool_bar_icon_size
(icon_size: PyQt5.QtCore.QSize, state: qtpydocking.enums.WidgetState)[source]¶ This function sets the tool button icon size for the given state. If a dock widget is floating, there is more space an increasing the icon size is possible. For docked widgets, small icon sizes, eg. 16 x 16 might be better.
- Parameters
- icon_sizeQSize
- stateWidgetState
-
set_tool_bar_style
(style: PyQt5.QtCore.Qt.ToolButtonStyle, state: qtpydocking.enums.WidgetState)[source]¶ This function sets the tool button style for the given dock widget state. It is possible to switch the tool button style depending on the state. If a dock widget is floating, then here are more space and it is possible to select a style that requires more space like Qt.ToolButtonTextUnderIcon. For the docked state Qt.ToolButtonIconOnly might be better.
- Parameters
- styleQt.ToolButtonStyle
- stateWidgetState
-
set_toolbar_floating_style
(floating: bool)[source]¶ Adjusts the toolbar icon sizes according to the floating state
- Parameters
- top_levelbool
-
set_widget
(widget: PyQt5.QtWidgets.QWidget, insert_mode: qtpydocking.enums.InsertMode = <InsertMode.auto_scroll_area: 1>)[source]¶ Sets the widget for the dock widget to widget. The InsertMode defines how the widget is inserted into the dock widget. The content of a dock widget should be resizable do a very small size to prevent the dock widget from blocking the resizing. To ensure, that a dock widget can be resized very well, it is better to insert the content+ widget into a scroll area or to provide a widget that is already a scroll area or that contains a scroll area. If the InsertMode is AutoScrollArea, the DockWidget tries to automatically detect how to insert the given widget.
If the widget is derived from QScrollArea (i.e. an QAbstractItemView), then the widget is inserted directly. If the given widget is not a scroll area, the widget will be inserted into a scroll area. To force insertion into a scroll area, you can also provide the InsertMode ForceScrollArea. To prevent insertion into a scroll area, you can provide the InsertMode ForceNoScrollArea
- Parameters
- widgetQWidget
- insert_modeInsertMode
-
tab_widget
() → DockWidgetTab[source]¶ Returns the title bar widget of this dock widget
- Returns
- valueDockWidgetTab
-
toggle_view
(open_: bool)[source]¶ This property controls whether the dock widget is open or closed. The toogleViewAction triggers this slot
- Parameters
- open_bool
-
toggle_view_action
() → PyQt5.QtWidgets.QAction[source]¶ Returns a checkable action that can be used to show or close this dock widget. The action’s text is set to the dock widget’s window title.
- Returns
- valueQAction
-
toggle_view_internal
(open_: bool)[source]¶ Internal toggle view function that does not check if the widget already is in the given state
- Parameters
- open_bool
-
tool_bar
() → PyQt5.QtWidgets.QToolBar[source]¶ If the WithToolBar layout flag is enabled, then this function returns the dock widget toolbar. If the flag is disabled, the function returns a nullptr. This function returns the dock widget top tool bar. If no toolbar is assigned, this function returns nullptr. To get a vaild toolbar you either need to create a default empty toolbar via createDefaultToolBar() function or you need to assign you custom toolbar via setToolBar().
- Returns
- valueQToolBar
-
tool_bar_icon_size
(state: qtpydocking.enums.WidgetState) → PyQt5.QtCore.QSize[source]¶ Returns the icon size for a given docking state.
- Parameters
- stateWidgetState
- Returns
- valueQSize
-
tool_bar_style
(state: qtpydocking.enums.WidgetState) → PyQt5.QtCore.Qt.ToolButtonStyle[source]¶ Returns the tool button style for the given docking state.
- Parameters
- stateWidgetState
- Returns
- valueQt.ToolButtonStyle
-
qtpydocking.dock_widget_tab¶
-
class
qtpydocking.dock_widget_tab.
DockWidgetTab
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QFrame
-
contextMenuEvent
(ev: PyQt5.QtGui.QContextMenuEvent)[source]¶ Contextmenuevent
- Parameters
- evQContextMenuEvent
-
dock_area_widget
() → DockAreaWidget[source]¶ Returns the dock area widget this title bar belongs to.
- Returns
- valueDockAreaWidget
-
dock_widget
() → DockWidget[source]¶ Returns the dock widget this title widget belongs to
- Returns
- valueDockWidget
-
event
(e: PyQt5.QtCore.QEvent) → bool[source]¶ Track event ToolTipChange and set child ToolTip
- Parameters
- eQEvent
- Returns
- valuebool
-
is_closable
() → bool[source]¶ This function returns true if the assigned dock widget is closeable
- Returns
- valuebool
-
mouseDoubleClickEvent
(event: PyQt5.QtGui.QMouseEvent)[source]¶ Double clicking the tab widget makes the assigned dock widget floating
- Parameters
- eventQMouseEvent
-
mouseReleaseEvent
(ev: PyQt5.QtGui.QMouseEvent)[source]¶ Mouse release event
- Parameters
- evQMouseEvent
-
set_active_tab
(active: bool)[source]¶ Set this true to make this tab the active tab
- Parameters
- activebool
-
qtpydocking.eliding_label¶
-
class
qtpydocking.eliding_label.
ElidingLabel
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags()) QLabel(str, parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QLabel
-
elide_mode
() → PyQt5.QtCore.Qt.TextElideMode[source]¶ Returns the text elide mode. The default mode is ElideNone
- Returns
- valueQt.TextElideMode
-
mouseDoubleClickEvent
(ev: PyQt5.QtGui.QMouseEvent)[source]¶ Mousedoubleclickevent
- Parameters
- evQMouseEvent
Unused
-
mouseReleaseEvent
(event: PyQt5.QtGui.QMouseEvent)[source]¶ Mousereleaseevent
- Parameters
- eventQMouseEvent
-
qtpydocking.enums¶
-
class
qtpydocking.enums.
DockFlags
(value)[source]¶ Bases:
enum.IntFlag
These global configuration flags configure some global dock manager settings.
-
class
qtpydocking.enums.
InsertMode
(value)[source]¶ Bases:
enum.Enum
Sets the widget for the dock widget to widget.
The InsertMode defines how the widget is inserted into the dock widget. The content of a dock widget should be resizable do a very small size to prevent the dock widget from blocking the resizing. To ensure, that a dock widget can be resized very well, it is better to insert the content+ widget into a scroll area or to provide a widget that is already a scroll area or that contains a scroll area.
If the InsertMode is AutoScrollArea, the DockWidget tries to automatically detect how to insert the given widget. If the widget is derived from QScrollArea (i.e. an QAbstractItemView), then the widget is inserted directly. If the given widget is not a scroll area, the widget will be inserted into a scroll area.
To force insertion into a scroll area, you can also provide the InsertMode ForceScrollArea. To prevent insertion into a scroll area, you can provide the InsertMode ForceNoScrollArea
-
class
qtpydocking.enums.
ToggleViewActionMode
(value)[source]¶ Bases:
enum.Enum
This mode configures the behavior of the toggle view action.
If the mode if ActionModeToggle, then the toggle view action is a checkable action to show / hide the dock widget. If the mode is ActionModeShow, then the action is not checkable an it will always show the dock widget if clicked. If the mode is ActionModeShow, the user can only close the DockWidget with the close button.
qtpydocking.floating_dock_container¶
-
class
qtpydocking.floating_dock_container.
FloatingDockContainer
(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())[source]¶ Bases:
PyQt5.QtWidgets.QWidget
-
dock_container
() → qtpydocking.dock_container_widget.DockContainerWidget[source]¶ Access function for the internal dock container
- Returns
- valueDockContainerWidget
-
dock_widgets
() → list[source]¶ This function returns a list of all dock widget in this floating widget. This is a simple convenience function that simply calls the dockWidgets() function of the internal container widget.
- Returns
- valuelist
-
eventFilter
(watched: PyQt5.QtCore.QObject, event: PyQt5.QtCore.QEvent) → bool[source]¶ Eventfilter
- Parameters
- watchedQObject
Unused
- eventQEvent
- Returns
- valuebool
-
has_top_level_dock_widget
() → bool[source]¶ This function returns true, if this floating widget has only one single visible dock widget in a single visible dock area. The single dock widget is a real top level floating widget because no other widgets are docked.
- Returns
- valuebool
-
init_floating_geometry
(drag_start_mouse_pos: PyQt5.QtCore.QPoint, size: PyQt5.QtCore.QSize)[source]¶ Call this function if you just want to initialize the position and size of the floating widget
- Parameters
- drag_start_mouse_posQPoint
- sizeQSize
-
is_closable
() → bool[source]¶ This function returns true, if it can be closed. It can be closed, if all dock widgets in all dock areas can be closed
- Returns
- valuebool
-
move_floating
()[source]¶ Moves the widget to a new position relative to the position given when startFloating() was called
-
on_dock_area_current_changed
(index: int)[source]¶ On dock area current changed
- Parameters
- indexint
Unused
-
restore_state
(stream: PyQt5.QtCore.QXmlStreamReader, testing: bool) → bool[source]¶ Restores the state from given stream. If Testing is true, the function only parses the data from the given stream but does not restore anything. You can use this check for faulty files before you start restoring the state
- Parameters
- streamQXmlStreamReader
- testingbool
- Returns
- valuebool
-
start_dragging
(drag_start_mouse_pos: PyQt5.QtCore.QPoint, size: PyQt5.QtCore.QSize)[source]¶ Call this function to start dragging the floating widget
- Parameters
- drag_start_mouse_posQPoint
- sizeQSize
-
start_floating
(drag_start_mouse_pos: PyQt5.QtCore.QPoint, size: PyQt5.QtCore.QSize, drag_state: qtpydocking.enums.DragState)[source]¶ Starts floating at the given global position. Use moveToGlobalPos() to move the widget to a new position depending on the start position given in Pos parameter
- Parameters
- drag_start_mouse_posQPoint
- sizeQSize
- drag_stateDragState
-
qtpydocking.util¶
-
qtpydocking.util.
create_transparent_pixmap
(source: PyQt5.QtGui.QPixmap, opacity: float) → PyQt5.QtGui.QPixmap[source]¶ Creates a semi transparent pixmap from the given pixmap Source. The Opacity parameter defines the opacity from completely transparent (0.0) to completely opaque (1.0)
- Parameters
- sourceQPixmap
- opacityqreal
- Returns
- valueQPixmap
-
qtpydocking.util.
emit_top_level_event_for_widget
(widget: Optional[DockWidget], floating: bool)[source]¶ Call this function to emit a topLevelChanged() signal and to update the dock area tool bar visibility
- Parameters
- widgetDockWidget
The top-level dock widget
- floatingbool
-
qtpydocking.util.
event_filter_decorator
(method)[source]¶ PySide2 exhibits some strange behavior where an eventFilter may get a ‘PySide2.QtWidgets.QWidgetItem` as the event argument. This wrapper effectively just makes those specific cases a no-operation.
- NOTE::
This is considered a work-around until the source of the issue can be determined.
-
qtpydocking.util.
find_child
(parent: Type[PyQt5.QtCore.QObject], type: Type[PyQt5.QtCore.QObject], name: str = '', options: PyQt5.QtCore.Qt.FindChildOptions = 1) → Optional[PyQt5.QtCore.QObject][source]¶ Returns the child of this object that can be cast into type T and that is called name, or nullptr if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used.
WARNING: If you’re using PySide, PySide2 or PyQt4, the options parameter will be discarded.
-
qtpydocking.util.
find_children
(parent: Type[PyQt5.QtCore.QObject], type: Type[PyQt5.QtCore.QObject], name: Union[str, PyQt5.QtCore.QRegExp] = '', options: PyQt5.QtCore.Qt.FindChildOptions = 1) → Optional[Any][source]¶ Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
WARNING: If you’re using PySide, PySide2 or PyQt4, the options parameter will be discarded.
-
qtpydocking.util.
find_parent
(parent_type, widget)[source]¶ Searches for the parent widget of the given type. Returns the parent widget of the given widget or 0 if the widget is not child of any widget of type T
It is not safe to use this function in in DockWidget because only the current dock widget has a parent. All dock widgets that are not the current dock widget in a dock area have no parent.
-
qtpydocking.util.
hide_empty_parent_splitters
(splitter: qtpydocking.dock_splitter.DockSplitter)[source]¶ This function walks the splitter tree upwards to hides all splitters that do not have visible content
- Parameters
- splitterDockSplitter