Пример #1
0
    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)
Пример #2
0
    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])
Пример #3
0
 def dragEnterEvent(self, event: QtGui.QDragEnterEvent):
     md = event.mimeData()
     if md.hasImage() or md.hasUrls():
         event.acceptProposedAction()
Пример #4
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     if event.mimeData().hasUrls:
         event.accept()
Пример #5
0
 def dragEnterEvent(self, event: QDragEnterEvent) -> None:
     mime_data: QMimeData = event.mimeData()
     if mime_data.hasUrls():
         event.accept()
Пример #6
0
 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()
Пример #8
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     source = event.source()
     if isinstance(source, QTreeView):
         if isinstance(source.model(), PaPITreeProxyModel):
             event.acceptProposedAction()
Пример #9
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     logger.info("dragEnterEvent %s", event)
     event.acceptProposedAction()
Пример #10
0
 def dragEnterEvent(self, e: QDragEnterEvent) -> None:
     self.draggedItem = self.indexAt(e.pos())
     e.setDropAction(Qt.MoveAction)
     super().dragEnterEvent(e)
Пример #11
0
 def _textEdit_dragEnterEvent(self, a0: QtGui.QDragEnterEvent) -> None:
     if a0.mimeData().hasText():
         a0.accept()
     else:
         a0.ignore()
Пример #12
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     self.active_element = self.indexAt(event.pos()).row()
     event.accept()
     super().dragEnterEvent(event)
Пример #13
0
 def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None:
     if event.mimeData().hasUrls():
         event.acceptProposedAction()
Пример #14
0
 def dragEnterEvent(self, e: QDragEnterEvent) -> None:
     e.acceptProposedAction()
Пример #15
0
 def dragEnterEvent(self, e: QDragEnterEvent):
     if e.mimeData().hasUrls():
         e.accept()
     else:
         e.ignore()
Пример #16
0
 def dragEnterEvent(self, event: QDragEnterEvent) -> None:
     if event.mimeData().hasUrls():
         event.accept()
Пример #17
0
 def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None:
     mime = event.mimeData()
     if mime.hasUrls():
         event.accept()
     super(BaseImageViewer, self).dragEnterEvent(event)
Пример #18
0
 def dragEnterEvent(self, event: QtGui.QDragEnterEvent) -> None:
     if event.mimeData().hasFormat("viur/treeDragData"):
         event.accept()
     else:
         event.ignore()
Пример #19
0
 def dragEnterEvent(self, a0: QtGui.QDragEnterEvent) -> None:
     self.setWindowTitle('mouse in')
     print(a0.mimeData().text())
     a0.accept()
Пример #20
0
 def dragEnterEvent(self, e: QtGui.QDragEnterEvent):
     print(e)
     if e.mimeData().hasText():
         e.accept()
     else:
         e.ignore()
Пример #21
0
 def dragEnterEvent(self, a0: QtGui.QDragEnterEvent):
     a0.accept()
Пример #22
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     event.acceptProposedAction()
Пример #23
0
 def dragEnterEvent(self, a0: QtGui.QDragEnterEvent) -> None:
     self.label.setText('拖拽apk文件到这里')
     a0.accept()
Пример #24
0
 def dragEnterEvent(self, e: QtGui.QDragEnterEvent) -> None:
     if e.mimeData().hasUrls():
         e.acceptProposedAction()
     else:
         print(e.mimeData().text())
Пример #25
0
 def dragEnterEvent(self, a0: QDragEnterEvent) -> None:
     a0.accept()
Пример #26
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     event.acceptProposedAction()
     self.drag_active = True
Пример #27
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     if event.mimeData().hasText():
         event.acceptProposedAction()
     else:
         event.ignore()
         QTableView.dragEnterEvent(self, event)
Пример #28
0
 def dragEnterEvent(self, event: QtGui.QDragEnterEvent):
     if event.source() == self:
         event.accept()
Пример #29
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     event.acceptProposedAction()
     self.drag_active = True
Пример #30
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     source = event.source()
     if isinstance(source, QTreeView):
         if isinstance(source.model(), PaPITreeProxyModel):
             event.acceptProposedAction()
Пример #31
0
 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()
Пример #32
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     self.active_element = self.indexAt(event.pos()).row()
     event.accept()
     super().dragEnterEvent(event)
Пример #33
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     event.accept()
Пример #34
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     event.accept()
Пример #35
0
 def dragEnterEvent(self, event: QDragEnterEvent):
     event.acceptProposedAction()