94 |
94 |
95 @param event reference to the drag enter event (QDragEnterEvent) |
95 @param event reference to the drag enter event (QDragEnterEvent) |
96 """ |
96 """ |
97 mimeData = event.mimeData() |
97 mimeData = event.mimeData() |
98 formats = mimeData.formats() |
98 formats = mimeData.formats() |
99 if formats.contains("action") and \ |
99 if "action" in formats and \ |
100 mimeData.data("action") == "tab-reordering" and \ |
100 mimeData.data("action") == "tab-reordering" and \ |
101 formats.contains("tabbar-id") and \ |
101 "tabbar-id" in formats and \ |
102 formats.contains("source-index") and \ |
102 "source-index" in formats and \ |
103 formats.contains("tabwidget-id"): |
103 "tabwidget-id" in formats: |
104 event.acceptProposedAction() |
104 event.acceptProposedAction() |
105 E4WheelTabBar.dragEnterEvent(self, event) |
105 E4WheelTabBar.dragEnterEvent(self, event) |
106 |
106 |
107 def dropEvent(self, event): |
107 def dropEvent(self, event): |
108 """ |
108 """ |
109 Protected method to handle drop events. |
109 Protected method to handle drop events. |
110 |
110 |
111 @param event reference to the drop event (QDropEvent) |
111 @param event reference to the drop event (QDropEvent) |
112 """ |
112 """ |
113 mimeData = event.mimeData() |
113 mimeData = event.mimeData() |
114 oldID = mimeData.data("tabbar-id").toLong()[0] |
114 oldID = mimeData.data("tabbar-id") |
115 fromIndex = mimeData.data("source-index").toInt()[0] |
115 fromIndex = mimeData.data("source-index") |
116 toIndex = self.tabAt(event.pos()) |
116 toIndex = self.tabAt(event.pos()) |
117 if oldID != id(self): |
117 if oldID != id(self): |
118 parentID = mimeData.data("tabwidget-id").toLong()[0] |
118 parentID = mimeData.data("tabwidget-id") |
119 if event.proposedAction() == Qt.MoveAction: |
119 if event.proposedAction() == Qt.MoveAction: |
120 self.emit(SIGNAL("tabRelocateRequested(long, int, int)"), |
120 self.emit(SIGNAL("tabRelocateRequested(long, int, int)"), |
121 parentID, fromIndex, toIndex) |
121 parentID, fromIndex, toIndex) |
122 event.acceptProposedAction() |
122 event.acceptProposedAction() |
123 elif event.proposedAction() == Qt.CopyAction: |
123 elif event.proposedAction() == Qt.CopyAction: |
282 """ |
282 """ |
283 self.__navigationMenu.clear() |
283 self.__navigationMenu.clear() |
284 for index in range(self.count()): |
284 for index in range(self.count()): |
285 act = self.__navigationMenu.addAction(self.tabIcon(index), |
285 act = self.__navigationMenu.addAction(self.tabIcon(index), |
286 self.tabText(index)) |
286 self.tabText(index)) |
287 act.setData(QVariant(index)) |
287 act.setData(index) |
288 |
288 |
289 def __navigationMenuTriggered(self, act): |
289 def __navigationMenuTriggered(self, act): |
290 """ |
290 """ |
291 Private slot called to handle the navigation button menu selection. |
291 Private slot called to handle the navigation button menu selection. |
292 |
292 |
293 @param act reference to the selected action (QAction) |
293 @param act reference to the selected action (QAction) |
294 """ |
294 """ |
295 index, ok = act.data().toInt() |
295 index, ok = act.data() |
296 if ok: |
296 if ok: |
297 self.setCurrentIndex(index) |
297 self.setCurrentIndex(index) |
298 |
298 |
299 def showIndicator(self, on): |
299 def showIndicator(self, on): |
300 """ |
300 """ |