예제 #1
0
void ListView::startDrag()
{
#if QT_VERSION < 300
    if (m_mousePressPos.isNull()) return;
    m_mousePressPos = QPoint(0, 0);
#endif
    emit dragStart();
    startDrag(dragObject());
}
예제 #2
0
void TreeView::startDrag()
{
  Q3DragObject *drag = dragObject();

  if (!drag)
     return;

  drag->dragMove();
}
예제 #3
0
파일: kfwin.cpp 프로젝트: Fat-Zer/tdebase
// copy to clipboard aka X11 selection
void KfindWindow::copySelection()
{
  TQDragObject *drag_obj = dragObject();

  if (drag_obj)
  {
    TQClipboard *cb = kapp->clipboard();
    cb->setData(drag_obj);
  }
}
예제 #4
0
void TextShow::copy()
{
    QTextDrag *drag = dragObject(NULL);
    if ( !drag )
        return;
#if COMPAT_QT_VERSION <= 0x030100
    QApplication::clipboard()->setData(drag);
#else
    QApplication::clipboard()->setData(drag, QClipboard::Clipboard);
#endif
}
예제 #5
0
void TextShow::startDrag()
{
    QDragObject *drag = dragObject(viewport());
    if (drag == NULL)
        return;
    if (isReadOnly()) {
        drag->dragCopy();
    } else {
        if (drag->drag() && QDragObject::target() != this && QDragObject::target() != viewport() )
            removeSelectedText();
    }
}
예제 #6
0
파일: PlayField.cpp 프로젝트: KDE/ksokoban
void
PlayField::mousePressEvent(QMouseEvent *e) {
  if (!canMoveNow()) return;

  if (dragInProgress_) {
    if (e->button() == Qt::LeftButton) dragObject(e->x(), e->y());
    else stopDrag();
    return;
  }

  int x=pixel2x(e->x());
  int y=pixel2y(e->y());

  if (x < 0 || y < 0 || x >= levelMap_->width() || y >= levelMap_->height())
    return;

  if (e->button() == Qt::LeftButton && pathFinder_.canDrag(x, y)) {
    changeCursor(Qt::SizeAllCursor);

    highlightX_ = x;
    highlightY_ = y;
    update(x2pixel(x), y2pixel(y), size_, size_);
    pathFinder_.updatePossibleDestinations(x, y);

    dragX_ = x2pixel(x);
    dragY_ = y2pixel(y);
    mousePosX_ = e->x() - dragX_;
    mousePosY_ = e->y() - dragY_;
    dragInProgress_ = true;
  }

  Move *m;
  switch (e->button()) {
  case Qt::LeftButton:
    m = pathFinder_.search(levelMap_, x, y);
    if (m != 0) {
      history_->add(m);

      startMoving(m);
    }
    break;
  case Qt::MidButton:
    undo();
    return;
    break;
  case Qt::RightButton:
    push(x, y);
    break;

  default:
    return;
  }
}
예제 #7
0
void TextShow::slotSelectionChanged()
{
#if COMPAT_QT_VERSION >= 0x030100
    disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0);
    if (QApplication::clipboard()->supportsSelection()){
        QTextDrag *drag = dragObject(NULL);
        if ( !drag )
            return;
        QApplication::clipboard()->setData(drag, QClipboard::Selection);
        connect( QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(clipboardChanged()));
    }
#endif
}
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();
        }
      }
    }
  }
}
예제 #9
0
void ListView::startDrag()
{
    emit dragStart();
    startDrag(dragObject());
}
예제 #10
0
파일: PlayField.cpp 프로젝트: KDE/ksokoban
void
PlayField::mouseReleaseEvent(QMouseEvent *e) {
  if (dragInProgress_) dragObject(e->x(), e->y());
}
예제 #11
0
void DraggableListView::startDrag() {
  Q3DragObject *o = dragObject();
  if (o) {
    o->drag();
  }
}