Example #1
0
void TextShow::startDrag()
{
    QDragObject *drag = new QTextDrag(selectedText(), viewport());
    if ( isReadOnly() ) {
        drag->dragCopy();
    } else {
        if ( drag->drag() && QDragObject::target() != this && QDragObject::target() != viewport() )
            removeSelectedText();
    }
}
Example #2
0
// Start a drag.
void QsciScintillaQt::StartDrag()
{
    inDragDrop = ddDragging;

    QDragObject *dobj = new QTextDrag(textRange(&drag), qsb->viewport());

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

    SetDragPosition(QSCI_SCI_NAMESPACE(SelectionPosition)());
    inDragDrop = ddNone;
}
void KstViewWidget::leaveEvent(QEvent *e) {
  //kstdDebug() << "Leave event" << endl;
  QWidget::leaveEvent(e);
  if (_view->viewMode() != KstTopLevelView::DisplayMode) {
    if (_menu) {
      return;
    }
    if (!_view->tracking()) {
      //kstdDebug() << "Not tracking" << endl;
      _view->clearFocus();
    } else {
      //kstdDebug() << "Tracking" << endl;
      if (_view->trackingIsMove() && _dragEnabled) {
        QDragObject *d = dragObject();
        if (d) {
          // First cancel any operations
          _view->cancelMouseOperations();
          _view->paint(KstPainter::P_PAINT);
          d->drag();
        }
      }
    }
  }
}