def move(self, widget: QtAds.CDockWidget, move_to: QtAds.CDockManager) -> None: if widget and move_to: widget.dockManager().removeDockWidget(widget) move_to.addDockWidget(QtAds.CenterDockWidgetArea, widget, move_to.getInsertDefaultPos()) else: assert False
def on_focused_dock_widget_changed(old: QtAds.CDockWidget, now: QtAds.CDockWidget): global count qDebug( "{:d} CDockManager::focusedDockWidgetChanged old: {} now: {} visible: {}" .format(count, old.objectName() if old else "-", now.objectName(), now.isVisible())) count += 1 now.widget().setFocus()
def features_string(dock_widget: QtAds.CDockWidget) -> str: '''Function returns a features string with closable (c), movable (m) and floatable (f) features. i.e. The following string is for a not closable but movable and floatable widget: c- m+ f+''' f = dock_widget.features() closable = f & QtAds.CDockWidget.DockWidgetClosable movable = f & QtAds.CDockWidget.DockWidgetMovable floatable = f & QtAds.CDockWidget.DockWidgetFloatable return "c{} m{} f{}".format("+" if closable else "-", "+" if movable else "-", "+" if floatable else "-")
def append_feature_string_to_window_title(dock_widget: QtAds.CDockWidget): '''Appends the string returned by features_string() to the window title of the given DockWidget''' dock_widget.setWindowTitle(dock_widget.windowTitle() + " ({})".format(features_string(dock_widget)))