// Start a drag.
void ScintillaQt::StartDrag()
{
    inDragDrop = ddDragging;

    QDrag *qdrag = new QDrag(qsb);
    qdrag->setMimeData(mimeSelection(drag));

# if QT_VERSION >= 0x040300
    // The default action is to copy so that the cursor is correct when over
    // another widget or application (when we have no control over it).  We
    // make sure it is correct over ourself in the event handlers.
    Qt::DropAction action = qdrag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction);
# else
    Qt::DropAction action = qdrag->start(Qt::MoveAction);
# endif

    // Remove the dragged text if it was a move to another widget or
    // application.
    if (action == Qt::MoveAction && qdrag->target() != qsb->viewport())
        ClearSelection();

    SetDragPosition(SelectionPosition());
    inDragDrop = ddNone;
}
예제 #2
0
// Handle drag leaves.
void QsciScintillaBase::dragLeaveEvent(QDragLeaveEvent *)
{
    sci->SetDragPosition(SelectionPosition());
}