// ! [4] protected void dropEvent(QDropEvent event) { textBrowser.setPlainText(event.mimeData().text()); mimeTypeCombo.clear(); mimeTypeCombo.addItems(event.mimeData().formats()); event.acceptProposedAction(); }
// ! [1] protected void dropEvent(QDropEvent event) { if (event.source() == this && event.possibleActions().isSet(Qt.DropAction.MoveAction)) return; // ! [1] // ! [2] if (event.proposedAction().equals(Qt.DropAction.MoveAction)) { event.acceptProposedAction(); // Process the data from the event. // ! [2] dragResult.emit(tr("The data was moved here.")); // ! [3] } else if (event.proposedAction().equals(Qt.DropAction.CopyAction)) { event.acceptProposedAction(); // Process the data from the event. // ! [3] dragResult.emit(tr("The data was copied here.")); // ! [4] } else { // Ignore the drop. return; } // ! [4] // End of quote mimeTypes.emit(event.mimeData().formats()); setData( event.mimeData().formats().get(0), event.mimeData().data(event.mimeData().formats().get(0))); // ! [5] }
public void dropEvent(QDropEvent event) { if (log.isTraceEnabled()) log.trace("dropEvent(): event=" + event); Vector<SongRecord> songs = DragDropUtil.getSongs(event.mimeData()); FilterProfile filter = (FilterProfile) ProfileWidgetUI.instance.getCurrentProfile(); filter.getFilterRecord().addSongRecords(songs); filter.getFilterRecord().computeNumSongRecords(); filter.getFilterRecord().update(); }