127 @param toolBar reference to the toolbar to be managed (QToolBar) |
127 @param toolBar reference to the toolbar to be managed (QToolBar) |
128 @param category category for the toolbar (string) |
128 @param category category for the toolbar (string) |
129 """ |
129 """ |
130 if toolBar is None: |
130 if toolBar is None: |
131 return |
131 return |
132 if toolBar in self.__toolBars: |
|
133 return |
|
134 |
132 |
135 newActions = [] |
133 newActions = [] |
136 newActionsWithSeparators = [] |
134 newActionsWithSeparators = [] |
137 actions = toolBar.actions() |
135 actions = toolBar.actions() |
138 for action in actions: |
136 for action in actions: |
|
137 actID = id(action) |
139 self.addAction(action, category) |
138 self.addAction(action, category) |
140 if id(action) in self.__widgetActions: |
139 if actID in self.__widgetActions: |
141 self.__widgetActions[id(action)] = toolBar |
140 self.__widgetActions[actID] = toolBar |
142 newActionsWithSeparators.append(action) |
141 newActionsWithSeparators.append(action) |
143 if action.isSeparator(): |
142 if action.isSeparator(): |
144 action = None |
143 action = None |
145 else: |
144 else: |
146 self.__actionToToolBars[id(action)].append(toolBar) |
145 if toolBar not in self.__actionToToolBars[actID]: |
|
146 self.__actionToToolBars[actID].append(toolBar) |
147 newActions.append(action) |
147 newActions.append(action) |
148 tbID = id(toolBar) |
148 tbID = id(toolBar) |
149 self.__defaultToolBars[tbID] = newActions |
149 self.__defaultToolBars[tbID] = newActions |
150 self.__toolBars[tbID] = newActions |
150 self.__toolBars[tbID] = newActions |
151 self.__toolBarsWithSeparators[tbID] = newActionsWithSeparators |
151 self.__toolBarsWithSeparators[tbID] = newActionsWithSeparators |
381 """ |
381 """ |
382 if action is None: |
382 if action is None: |
383 return |
383 return |
384 if action.isSeparator(): |
384 if action.isSeparator(): |
385 return |
385 return |
386 if action in self.__allActions: |
386 if id(action) in self.__allActions: |
387 return |
387 return |
388 |
388 |
389 if action.metaObject().className() == "QWidgetAction": |
389 if action.metaObject().className() == "QWidgetAction": |
390 self.__widgetActions[id(action)] = None |
390 self.__widgetActions[id(action)] = None |
391 self.__allWidgetActions[id(action)] = action |
391 self.__allWidgetActions[id(action)] = action |