def dragMoveEvent(self, e: QDragMoveEvent): e.setDropAction(Qt.CopyAction) e.accept() if not self.hasFocus(): self.update() self._mousePos = e.pos() self.startAnimation()
def dragMoveEvent(self, a0: QtGui.QDragMoveEvent) -> None: if a0.mimeData().hasUrls() and len( a0.mimeData().urls()) == 1 and os.path.isfile( a0.mimeData().urls()[0].toLocalFile()): a0.setDropAction(QtCore.Qt.CopyAction) a0.accept() else: a0.ignore()
def dragMoveEvent(self, event: QtGui.QDragMoveEvent) -> None: """Handles the move event of the dragged image. Parameters ---------- event: QDragMoveEvent The identified event """ if event.mimeData().hasImage: event.accept() else: event.ignore()
def dragMoveEvent(self, event: QtGui.QDragMoveEvent) -> None: obj: TextWidget = event.source() modifier_pressed = QtWidgets.QApplication.keyboardModifiers() shift_pressed = (int(modifier_pressed) & QtCore.Qt.ShiftModifier) == QtCore.Qt.ShiftModifier if self.manager.widget_manager.get_dor() == DRAG: obj.move(event.pos().x() - self.manager.widget_manager.drag_dot[0], event.pos().y() - self.manager.widget_manager.drag_dot[1]) x, y, _, _, x_mod, y_mod, widgets = self.manager.widget_manager.drag_magnet_checker( obj) if shift_pressed: if not x_mod: x = x - (x - self.manager.grid_manager.zero_point_dot.get_pos()[0]) \ % (OFFSET_MAGNET * 2) if not y_mod: y = y - (y - self.manager.grid_manager.zero_point_dot.get_pos()[1]) \ % (OFFSET_MAGNET * 2) x, y = max(x, 0), max(y, 0) if self.manager.grid_manager.grid.show: x, y, widgets = \ self.manager.grid_manager.check_and_set_grid_magnet_lines_for_resizing( obj, x, y, x_mod, y_mod, widgets ) self.manager.widget_manager.set_coords_on_widgets( widgets, event, x, y) obj.move_event(x, y) obj.update_arrows() elif self.manager.widget_manager.get_dor() == RESIZE: obj_x1, obj_y1, obj_x2, obj_y2, x_mod, y_mod, widgets = \ self.manager.widget_manager.resize_magnet_checker(obj, event.pos()) x, y = obj_x2 - obj_x1, obj_y2 - obj_y1 if shift_pressed: if not x_mod: x = max(x - x % (OFFSET_MAGNET * 2), 0) if not y_mod: y = max(y - y % (OFFSET_MAGNET * 2), 0) self.manager.widget_manager.set_coords_on_widgets( widgets, event, x, y) obj.resize_event(x, y) self.update()
def dragMoveEvent(self, event: QDragMoveEvent): pos = event.pos() row = self.rowAt(pos.y()) index = self.model().createIndex(row, 0) # this always get the default 0 column index rect = self.visualRect(index) rect_left = self.visualRect(index.sibling(index.row(), 0)) rect_right = self.visualRect(index.sibling(index.row(), self.horizontalHeader().logicalIndex( self.model().columnCount() - 1))) # in case section has been moved self.drop_indicator_position = self.position(event.pos(), rect) if self.drop_indicator_position == self.AboveItem: self.drop_indicator_rect = QRect(rect_left.left(), rect_left.top(), rect_right.right() - rect_left.left(), 0) event.accept() elif self.drop_indicator_position == self.BelowItem: self.drop_indicator_rect = QRect(rect_left.left(), rect_left.bottom(), rect_right.right() - rect_left.left(), 0) event.accept() elif self.drop_indicator_position == self.OnItem: self.drop_indicator_rect = QRect(rect_left.left(), rect_left.bottom(), rect_right.right() - rect_left.left(), 0) event.accept() else: self.drop_indicator_rect = QRect() # This is necessary or else the previously drawn rect won't be erased self.viewport().update()
def _drag_move_event(self, event: QDragMoveEvent): index = self.ui.dirTree.indexAt(event.pos()) mime_data = event.mimeData() if mime_data.hasFormat(MimeTypes[real_folder]): if not self.ui.dirTree.model().is_virtual(index): event.ignore() else: event.accept() else: event.accept()
def dragMoveEvent(self, event: QtGui.QDragMoveEvent) -> None: if event.mimeData().hasUrls: event.setDropAction(QtCore.Qt.CopyAction) event.accept() return else: event.ignore()
def set_coords_on_widgets(self, widgets: list or tuple, event: QtGui.QDragMoveEvent, x: int, y: int): """ sets label for widgets with distance to some widget :param widgets: widgets that need label :param event: event for position of mouse :param x: x coordinate of main widget :param y: y coordinate of main widget """ [widget.hide_size_or_pos_label() for widget in self.get_all_widgets()] for widget, (way_x, way_y) in widgets.items(): if way_x or way_y: widget.show_size_or_pos_label() widget.set_size_or_pos_label( "{} {}".format(str(str(abs((x + event.source().width() // 2) - way_x) if way_x else '') + '↔') if way_x else '', str(str(abs((y + event.source().height() // 2) - way_y) if way_y else '') + '↕') if way_y else '') )
def dragMoveEvent(self, event: QDragMoveEvent): self.cleanDraggingEffects() if 'Group:' in event.mimeData().text(): palette = self.ui.line.palette() palette.setColor(QPalette.Dark, QColor(89, 173, 223)) self.ui.line.setPalette(palette) else: self.ui.top_widget.setStyleSheet( """ .QWidget { border: 1px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 blue,""" """ stop:0.5 rgb(89, 173, 223), stop:1 red); } """)
def dragMoveEvent(self, event: QDragMoveEvent): self.cleanDraggingEffects() loc = self.getDraggedLocation(event.pos()) if loc == -1: palette = self.ui.line.palette() palette.setColor(QPalette.Dark, QColor(89, 173, 223)) self.ui.line.setPalette(palette) else: self.ui.setStyleSheet(""" .QWidget { border: 1px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 blue,""" """ stop:0.5 rgb(89, 173, 223), stop:1 red); } """)
def dragMoveEvent(self, event: QDragMoveEvent): pos = event.pos() row = self.rowAt(pos.y()) index = self.model().createIndex( row, 0) # this always get the default 0 column index rect = self.visualRect(index) rect_left = self.visualRect(index.sibling(index.row(), 0)) rect_right = self.visualRect( index.sibling( index.row(), self.horizontalHeader().logicalIndex( self.model().columnCount() - 1))) # in case section has been moved self.drop_indicator_position = self.position(event.pos(), rect) if self.drop_indicator_position == self.AboveItem: self.drop_indicator_rect = QRect( rect_left.left(), rect_left.top(), rect_right.right() - rect_left.left(), 0) event.accept() elif self.drop_indicator_position == self.BelowItem: self.drop_indicator_rect = QRect( rect_left.left(), rect_left.bottom(), rect_right.right() - rect_left.left(), 0) event.accept() elif self.drop_indicator_position == self.OnItem: self.drop_indicator_rect = QRect( rect_left.left(), rect_left.bottom(), rect_right.right() - rect_left.left(), 0) event.accept() else: self.drop_indicator_rect = QRect() # This is necessary or else the previously drawn rect won't be erased self.viewport().update()
def dragMoveEvent(self, event: QDragMoveEvent): if event.mimeData().hasText(): self.curRow = 0 index = self.indexAt(event.pos()) if index.isValid(): if event.pos().y( ) - index.row() * self.itemRowHeight >= self.itemRowHeight / 2: self.curRow = index.row() + 1 else: self.curRow = index.row() else: self.curRow = self.model.rowCount() self.targetRow = self.curRow self.lineLabel.setGeometry( 1, self.headerHeight + self.targetRow * self.itemRowHeight, self.width() - 2, 2) event.acceptProposedAction() return event.ignore() QTableView.dragMoveEvent(self, event)
def dragMoveEvent(self, event: QDragMoveEvent) -> None: event.accept()
def dragMoveEvent(self, event: QtGui.QDragMoveEvent) -> None: logger.debug("TreeListWidget.dragMoveEvent") if isinstance(self.itemAt(event.pos()), self.leafItem): event.ignore() else: event.accept()
def dragMoveEvent(self, event: QtGui.QDragMoveEvent) -> None: if self.itemAt(event.pos()): event.accept() else: event.ignore()
def dragMoveEvent(self, event: QDragMoveEvent): target = self.itemAt(event.pos()) if isinstance(target, FolderWidgetItem): QTreeWidget.dragMoveEvent(self, event) else: event.ignore()
def dragMoveEvent(self, e: QtGui.QDragMoveEvent) -> None: txt = e.mimeData().text() type, addr, content = txt.split(':') if type == self.type: e.accept()
def dragMoveEvent(self, event: QDragMoveEvent): if event.mimeData().hasFormat("application/x-simitemdata"): event.setDropAction(Qt.MoveAction) event.accept() else: event.ignore()
def dragMoveEvent(self, event: QDragMoveEvent): current_item = self.itemAt(event.pos()) if not current_item or current_item.parent(): event.ignore() else: super().dragMoveEvent(event)
def dragMoveEvent(self, event: QDragMoveEvent): if event.mimeData().hasFormat(PhysicalObjectsModel.MIME_TYPE): event.accept() else: event.ignore()
def dragMoveEvent(self, e: QDragMoveEvent) -> None: """拖拽移动过程中触发的事件""" e.accept()
def dragMoveEvent(self, e: QDragMoveEvent) -> None: if e.mimeData().hasFormat("pe4/asset"): e.setDropAction(Qt.MoveAction) e.accept() else: e.ignore()
def dragMoveEvent(self, event: QtGui.QDragMoveEvent) -> None: if event.mimeData().hasUrls(): event.acceptProposedAction()
def dragMoveEvent(self, a0: QtGui.QDragMoveEvent) -> None: print(a0.pos())
def dragMoveEvent(self, e: qtg.QDragMoveEvent) -> None: if e.mimeData().hasUrls(): e.acceptProposedAction() else: e.ignore()