def testMove(self): w = self.newWidget() item = w._path_item_map.get("/Variables/u") #b = w.tree.getBlockInfo("/Variables/u") w.scrollToItem(item) point = w.visualItemRect(item).center() item1 = w._path_item_map.get("/Variables/v") #b1 = w.tree.getBlockInfo("/Variables/v") w.scrollToItem(item1) point1 = w.visualItemRect(item1).bottomLeft() #idx = b.parent.children_list.index(b.name) #idx1 = b.parent.children_list.index(b1.name) w.setCurrentItem(item) mime = QMimeData() mime.setData(w._mime_type, "some data") ee = QDragEnterEvent(w.mapToGlobal(point), Qt.MoveAction, mime, Qt.LeftButton, Qt.NoModifier) w.dragEnterEvent(ee) #Testing.process_events(self.qapp, t=1) de = QDropEvent(w.mapToGlobal(point1), Qt.MoveAction, mime, Qt.LeftButton, Qt.NoModifier) w.dropEvent(de) # This doesn't seem to work for some reason #self.assertEqual(idx1, b.parent.children_list.index(b.name)) #self.assertEqual(idx, b.parent.children_list.index(b1.name)) w.setCurrentItem(None) self.assertEqual(w._current_drag, None) w.dropEvent(de) w.dragEnterEvent(ee) self.assertEqual(w._current_drag, None) w.setCurrentItem(item1) w.dragEnterEvent(ee) self.assertNotEqual(w._current_drag, None) w.dropEvent(de)
def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None: """ Allow Drag&Drop inside this widget (ie. moving files to subdirs) """ logger.debug("TreeListWidget.dragEnterEvent") if event.source() == self: event.accept() nodes = [] leafs = [] for item in self.selectedItems(): if isinstance(item, self.nodeItem): nodes.append(item.entryData) else: leafs.append(item.entryData) event.mimeData().setData( "viur/treeDragData", json.dumps({ "nodes": [x["key"] for x in nodes], "leafs": [x["key"] for x in leafs] }).encode("utf-8")) event.mimeData().setUrls( [utils.urlForItem(self.getModul(), x) for x in nodes] + [utils.urlForItem(self.getModul(), x) for x in leafs])
def dragEnterEvent(self, event: QtGui.QDragEnterEvent): md = event.mimeData() if md.hasImage() or md.hasUrls(): event.acceptProposedAction()
def dragEnterEvent(self, event: QDragEnterEvent): if event.mimeData().hasUrls: event.accept()
def dragEnterEvent(self, event: QDragEnterEvent) -> None: mime_data: QMimeData = event.mimeData() if mime_data.hasUrls(): event.accept()
def drag_enter_event(event: QDragEnterEvent) -> None: data = event.mimeData() url = data.urls()[0] if url and url.isLocalFile() and url.fileName().endswith('.pdf'): event.acceptProposedAction()
def dragEnterEvent(self, event:QDragEnterEvent): if event.mimeData().hasUrls(): event.acceptProposedAction() else: event.ignore()
def dragEnterEvent(self, event: QDragEnterEvent): source = event.source() if isinstance(source, QTreeView): if isinstance(source.model(), PaPITreeProxyModel): event.acceptProposedAction()
def dragEnterEvent(self, event: QDragEnterEvent): logger.info("dragEnterEvent %s", event) event.acceptProposedAction()
def dragEnterEvent(self, e: QDragEnterEvent) -> None: self.draggedItem = self.indexAt(e.pos()) e.setDropAction(Qt.MoveAction) super().dragEnterEvent(e)
def _textEdit_dragEnterEvent(self, a0: QtGui.QDragEnterEvent) -> None: if a0.mimeData().hasText(): a0.accept() else: a0.ignore()
def dragEnterEvent(self, event: QDragEnterEvent): self.active_element = self.indexAt(event.pos()).row() event.accept() super().dragEnterEvent(event)
def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None: if event.mimeData().hasUrls(): event.acceptProposedAction()
def dragEnterEvent(self, e: QDragEnterEvent) -> None: e.acceptProposedAction()
def dragEnterEvent(self, e: QDragEnterEvent): if e.mimeData().hasUrls(): e.accept() else: e.ignore()
def dragEnterEvent(self, event: QDragEnterEvent) -> None: if event.mimeData().hasUrls(): event.accept()
def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None: mime = event.mimeData() if mime.hasUrls(): event.accept() super(BaseImageViewer, self).dragEnterEvent(event)
def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None: if event.mimeData().hasFormat("viur/treeDragData"): event.accept() else: event.ignore()
def dragEnterEvent(self, a0: QtGui.QDragEnterEvent) -> None: self.setWindowTitle('mouse in') print(a0.mimeData().text()) a0.accept()
def dragEnterEvent(self, e: QtGui.QDragEnterEvent): print(e) if e.mimeData().hasText(): e.accept() else: e.ignore()
def dragEnterEvent(self, a0: QtGui.QDragEnterEvent): a0.accept()
def dragEnterEvent(self, event: QDragEnterEvent): event.acceptProposedAction()
def dragEnterEvent(self, a0: QtGui.QDragEnterEvent) -> None: self.label.setText('拖拽apk文件到这里') a0.accept()
def dragEnterEvent(self, e: QtGui.QDragEnterEvent) -> None: if e.mimeData().hasUrls(): e.acceptProposedAction() else: print(e.mimeData().text())
def dragEnterEvent(self, a0: QDragEnterEvent) -> None: a0.accept()
def dragEnterEvent(self, event: QDragEnterEvent): event.acceptProposedAction() self.drag_active = True
def dragEnterEvent(self, event: QDragEnterEvent): if event.mimeData().hasText(): event.acceptProposedAction() else: event.ignore() QTableView.dragEnterEvent(self, event)
def dragEnterEvent(self, event: QtGui.QDragEnterEvent): if event.source() == self: event.accept()
def dragEnterEvent(self, e: QtGui.QDragEnterEvent) -> None: file_name = e.mimeData().text() if file_name.split('.')[-1] in ['png', 'jpg', 'jpeg']: e.acceptProposedAction() else: e.ignore()
def dragEnterEvent(self, event: QDragEnterEvent): event.accept()