Example #1
3
  // ! [4]
  protected void dropEvent(QDropEvent event) {
    textBrowser.setPlainText(event.mimeData().text());
    mimeTypeCombo.clear();
    mimeTypeCombo.addItems(event.mimeData().formats());

    event.acceptProposedAction();
  }
Example #2
3
  // ! [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]
  }