31 from python_qt_binding.QtCore
import QSignalMapper, Qt
32 from python_qt_binding.QtGui
import QIcon
33 from python_qt_binding.QtWidgets
import QAction, QToolBar, QWidget
40 def __init__(self, container_manager, parent=None):
41 super(MinimizedDockWidgetsToolbar, self).
__init__(parent=parent)
42 self.setWindowTitle(self.tr(
'Minimized dock widgets'))
43 self.setObjectName(
'MinimizedDockWidgetsToolbar')
44 self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
56 icon = dock_widget.windowIcon()
58 icon = QIcon.fromTheme(
'folder')
59 title = dock_widget.windowTitle()
60 action = QAction(icon, title, self)
62 if len(title) > MinimizedDockWidgetsToolbar.max_label_length:
63 action.setToolTip(title)
64 action.setIconText(title[0:MinimizedDockWidgetsToolbar.max_label_length] +
'...')
65 self._signal_mapper.setMapping(action, dock_widget)
66 action.triggered.connect(self._signal_mapper.map)
68 self.addAction(action)
75 self.removeAction(action)
77 self._signal_mapper.removeMappings(action)
86 parent = self._container_manager.get_container_of_dock_widget(dock_widget)