Example #1
0
void qtractorFileListView::dropEvent ( QDropEvent *pDropEvent )
{
	QTreeWidgetItem *pDropItem = dragDropItem(pDropEvent->pos());
	if (!canDropItem(pDropItem)) {
		dragLeaveEvent(NULL);
		m_pDragItem = NULL;
		return;
	}

	// Not quite parent, but the exact drop target...
	qtractorFileGroupItem *pParentItem
		= static_cast<qtractorFileGroupItem *> (pDropItem);
	const bool bOutdent
		= (pDropEvent->pos().x() < QTreeWidget::indentation());

	// Get access to the pertinent drop data...
	int iUpdate = 0;
	const QMimeData *pMimeData = pDropEvent->mimeData();
	// Let's see how many files there are...
	if (pMimeData->hasUrls()) {
		QListIterator<QUrl> iter(pMimeData->urls());
		iter.toBack();
		while (iter.hasPrevious()) {
			const QString& sPath = iter.previous().toLocalFile();
			// Is it one from ourselves (file item) ?...
			if (m_pDragItem && m_pDragItem->type() == FileItem) {
				if (dropItem(pDropItem, findItem(sPath, FileItem), bOutdent))
					++iUpdate;
			} else if (addFileItem(sPath, pParentItem))
				++iUpdate;
		}
	} else if (pMimeData->hasText()) {
		// Maybe its just a new convenience group...
		const QString& sText = pMimeData->text();
		// Is it one from ourselves (group item) ?...
		if (m_pDragItem && m_pDragItem->type() == GroupItem) {
			if (dropItem(pDropItem, findItem(sText, GroupItem), bOutdent))
				++iUpdate;
		} else if (addGroupItem(sText, pParentItem))
			++iUpdate;
	}

	// Teke care of change modification...
	if (iUpdate > 0) {
		// Make parent open, anyway...
		qtractorFileGroupItem *pGroupItem = groupItem(pDropItem);
		if (pGroupItem)
			pGroupItem->setOpen(true);
		// Notify that we've changed something.
		emit contentsChanged();
	}

	dragLeaveEvent(NULL);
	m_pDragItem = NULL;
}
Example #2
0
// Master clean-up.
void qtractorFileListView::clear (void)
{
	dragLeaveEvent(NULL);
	m_pDragItem = NULL;

	QTreeWidget::clear();
}
Example #3
0
void QDateEdit_QtDShell::__override_dragLeaveEvent(QDragLeaveEvent*  arg__1, bool static_call)
{
    if (static_call) {
        QWidget::dragLeaveEvent((QDragLeaveEvent* )arg__1);
    } else {
        dragLeaveEvent((QDragLeaveEvent* )arg__1);
    }
}
void QAbstractPageSetupDialog_QtDShell::__override_dragLeaveEvent(QDragLeaveEvent*  arg__1, bool static_call)
{
    if (static_call) {
        QWidget::dragLeaveEvent((QDragLeaveEvent* )arg__1);
    } else {
        dragLeaveEvent((QDragLeaveEvent* )arg__1);
    }
}
void QGraphicsEllipseItem_QtDShell::__override_dragLeaveEvent(QGraphicsSceneDragDropEvent*  event0, bool static_call)
{
    if (static_call) {
        QGraphicsItem::dragLeaveEvent((QGraphicsSceneDragDropEvent* )event0);
    } else {
        dragLeaveEvent((QGraphicsSceneDragDropEvent* )event0);
    }
}
Example #6
0
void qtractorFileListView::mouseReleaseEvent ( QMouseEvent *pMouseEvent )
{
	QTreeWidget::mouseReleaseEvent(pMouseEvent);

	QTreeWidget::setSelectionMode(
		QAbstractItemView::ExtendedSelection);

	dragLeaveEvent(NULL);
	m_pDragItem = NULL;
}
Example #7
0
void qjackctlClientListView::dropEvent( QDropEvent *pDropEvent )
{
	if (pDropEvent->source() != this &&
		pDropEvent->mimeData()->hasText() &&
		dragDropItem(pDropEvent->pos())) {
		const QString sText = pDropEvent->mimeData()->text();
		qjackctlConnect *pConnect = m_pConnectView->binding();
		if (!sText.isEmpty() && pConnect)
			pConnect->connectSelected();
	}

	dragLeaveEvent(0);
}
Example #8
0
// Handle mouse events for drag-and-drop stuff.
void qtractorFileListView::mousePressEvent ( QMouseEvent *pMouseEvent )
{
	dragLeaveEvent(NULL);

	m_posDrag   = pMouseEvent->pos();
	m_pDragItem = QTreeWidget::itemAt(m_posDrag);

	if (pMouseEvent->button() == Qt::LeftButton
		&& (pMouseEvent->modifiers()
			& (Qt::ShiftModifier | Qt::ControlModifier)) == 0) {
		QTreeWidget::clearSelection();
		QTreeWidget::setSelectionMode(
			QAbstractItemView::SingleSelection);
	}

	QTreeWidget::setCurrentItem(m_pDragItem);

	QTreeWidget::mousePressEvent(pMouseEvent);
}
Example #9
0
bool ListDnd::eventFilter( QObject *, QEvent * event )
{
    switch ( event->type() ) {
    case QEvent::DragEnter:
	return dragEnterEvent( (QDragEnterEvent *) event );
    case QEvent::DragLeave:
	return dragLeaveEvent( (QDragLeaveEvent *) event );
    case QEvent::DragMove:
	return dragMoveEvent( (QDragMoveEvent *) event );
    case QEvent::Drop:
	return dropEvent( (QDropEvent *) event );
    case QEvent::MouseButtonPress:
	return mousePressEvent( (QMouseEvent *) event );
    case QEvent::MouseMove:
	return mouseMoveEvent( (QMouseEvent *) event );
    default:
	break;
    }
    return FALSE;
}
Example #10
0
bool KSVTrash::eventFilter( QObject *, QEvent *e )
{
  switch (e->type())
    {
    case QEvent::DragMove:
      dragMoveEvent ( static_cast<QDragMoveEvent*> (e) );
      return true;
      break;
      
    case QEvent::DragLeave:
      dragLeaveEvent ( static_cast<QDragLeaveEvent*> (e) );
      return true;
      break;
      
    case QEvent::Drop:
      dropEvent ( static_cast<QDropEvent*> (e) );
      return true;
      break;

    default:
      return false;
    }
}
Example #11
0
void DhQGLWidget::DvhdragLeaveEvent(QDragLeaveEvent* x1) {
  return dragLeaveEvent(x1);
}
Example #12
0
void DhQPushButton::DvhdragLeaveEvent(QDragLeaveEvent* x1) {
  return dragLeaveEvent(x1);
}
Example #13
0
void DhQAbstractSpinBox::DvhdragLeaveEvent(QDragLeaveEvent* x1) {
  return dragLeaveEvent(x1);
}
Example #14
0
void DhQGroupBox::DvhdragLeaveEvent(QDragLeaveEvent* x1) {
  return dragLeaveEvent(x1);
}
Example #15
0
void DhQGraphicsItemGroup::DvhdragLeaveEvent(QGraphicsSceneDragDropEvent* x1) {
  return dragLeaveEvent(x1);
}
Example #16
0
bool CloudView::eventFilter(QObject* obj, QEvent* event)
{
    if (obj == mHeader) {
        static QPoint oldPos;
        if (event->type() == QEvent::MouseButtonPress) {
            QMouseEvent* ev = (QMouseEvent*)event;
            oldPos = ev->globalPos();

            return true;
        }
        else if (event->type() == QEvent::MouseMove) {
            QMouseEvent* ev = (QMouseEvent*)event;
            const QPoint delta = ev->globalPos() - oldPos;

            MainWindow* win = seafApplet->mainWindow();
            win->move(win->x() + delta.x(), win->y() + delta.y());

            oldPos = ev->globalPos();
            return true;
        }
    }
    else if (obj == mDropArea) {
        if (event->type() == QEvent::DragEnter) {
            QDragEnterEvent* ev = (QDragEnterEvent*)event;
            if (ev->mimeData()->hasUrls() &&
                ev->mimeData()->urls().size() == 1) {
                const QUrl url = ev->mimeData()->urls().at(0);
                if (url.scheme() == "file") {
                    QString path = url.toLocalFile();
#if defined(Q_OS_MAC) && (QT_VERSION <= QT_VERSION_CHECK(5, 4, 0))
                    path = utils::mac::fix_file_id_url(path);
#endif
                    if (QFileInfo(path).isDir()) {
                        QString style =
                            QString("QFrame#mDropInner {border: 1.5px dashed %1;}")
                                .arg(kDrapEnterBorderColor);
                        mDropInner->setStyleSheet(style);
                        ev->acceptProposedAction();
                    }
                }
            }
            return true;
        }
        else if (event->type() == QEvent::Drop) {
            QDropEvent* ev = (QDropEvent*)event;
            const QUrl url = ev->mimeData()->urls().at(0);
            QString path = url.toLocalFile();
#if defined(Q_OS_MAC) && (QT_VERSION <= QT_VERSION_CHECK(5, 4, 0))
            path = utils::mac::fix_file_id_url(path);
#endif
            ev->setDropAction(Qt::CopyAction);
            ev->accept();
            QString style =
                QString("QFrame#mDropInner {border: 1.5px dashed %1;}")
                    .arg(kDrapInnerBorderColor);
            mDropInner->setStyleSheet(style);
            showCreateRepoDialog(path);
            return true;
        }
        else if (event->type() == QEvent::DragLeave) {
            QDragLeaveEvent* ev = static_cast<QDragLeaveEvent*>(event);
            dragLeaveEvent(ev);
            QString style =
                QString("QFrame#mDropInner {border: 1.5px dashed %1;}")
                    .arg(kDrapInnerBorderColor);
            mDropInner->setStyleSheet(style);
            return true;
        }
    }

    return QWidget::eventFilter(obj, event);
}
void DhQGraphicsEllipseItem::DvhdragLeaveEvent(QGraphicsSceneDragDropEvent* x1) {
  return dragLeaveEvent(x1);
}
Example #18
0
void DhQStackedWidget::DvhdragLeaveEvent(QDragLeaveEvent* x1) {
    return dragLeaveEvent(x1);
}
Example #19
0
// Handle events on behalf of the text area.
bool QsciScintillaBase::eventFilter(QObject *o, QEvent *e)
{
    if (o != txtarea)
        return QWidget::eventFilter(o, e);

    bool used = true;

    switch (e->type())
    {
    case QEvent::ContextMenu:
        contextMenuEvent(static_cast<QContextMenuEvent *>(e));
        break;

    case QEvent::DragEnter:
        dragEnterEvent(static_cast<QDragEnterEvent *>(e));
        break;

    case QEvent::DragLeave:
        dragLeaveEvent(static_cast<QDragLeaveEvent *>(e));
        break;

    case QEvent::DragMove:
        dragMoveEvent(static_cast<QDragMoveEvent *>(e));
        break;

    case QEvent::Drop:
        dropEvent(static_cast<QDropEvent *>(e));
        break;

    case QEvent::MouseButtonDblClick:
        mouseDoubleClickEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::MouseButtonPress:
        mousePressEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::MouseButtonRelease:
        mouseReleaseEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::MouseMove:
        mouseMoveEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::Paint:
        paintEvent(static_cast<QPaintEvent *>(e));
        break;

    case QEvent::Resize:
        resizeEvent(static_cast<QResizeEvent *>(e));
        break;

    case QEvent::Wheel:
        {
            QWheelEvent *we = static_cast<QWheelEvent *>(e);

            setFocus();

            if (we->orientation() == Horizontal || we->state() & ShiftButton)
                QApplication::sendEvent(hsb, we);
            else if (we->orientation() == Vertical)
                QApplication::sendEvent(vsb, we);

            break;
        }

    default:
        used = false;
    }

    return used;
}
Example #20
0
void qtractorFileListView::mouseMoveEvent ( QMouseEvent *pMouseEvent )
{
	QTreeWidget::mouseMoveEvent(pMouseEvent);

	if ((pMouseEvent->buttons() & Qt::LeftButton) && m_pDragItem
		&& ((pMouseEvent->pos() - m_posDrag).manhattanLength()
			>= QApplication::startDragDistance())) {
		// We'll start dragging something alright...
		QMimeData *pMimeData = NULL;
		switch (m_pDragItem->type()) {
		case GroupItem: {
			pMimeData = new QMimeData();
			pMimeData->setText(m_pDragItem->text(0));
			break;
		}
		case FileItem: {
			// Selected items must only be file items...
			QList<QUrl> urls;
			QListIterator<QTreeWidgetItem *> iter(selectedItems());
			while (iter.hasNext()) {
				QTreeWidgetItem *pItem = iter.next();
				if (pItem->type() == FileItem) {
					qtractorFileListItem *pFileItem
						= static_cast<qtractorFileListItem *> (pItem);
					if (pFileItem)
						urls.append(QUrl::fromLocalFile(pFileItem->path()));
				}
			}
			// Have we got something?
			if (!urls.isEmpty()) {
				pMimeData = new QMimeData();
				pMimeData->setUrls(urls);
			}
			break;
		}
		case ChannelItem: {
			qtractorFileChannelDrag::List items;
			QListIterator<QTreeWidgetItem *> iter(selectedItems());
			while (iter.hasNext()) {
				QTreeWidgetItem *pItem = iter.next();
				if (pItem->type() == ChannelItem) {
					qtractorFileChannelItem *pChannelItem
						= static_cast<qtractorFileChannelItem *> (pItem);
					if (pChannelItem) {
						qtractorFileChannelDrag::Item item;
						item.channel = pChannelItem->channel();
						item.path = pChannelItem->path();
						items.append(item);
					}
				}
			}
			if (!items.isEmpty()) {
				pMimeData = new QMimeData();
				qtractorFileChannelDrag::encode(pMimeData, items);
			}
			break;
		}
		default:
			break;
		}
		// Have we got it right?
		if (pMimeData) {
			QDrag *pDrag = new QDrag(this);
			pDrag->setMimeData(pMimeData);
			pDrag->setPixmap(m_pDragItem->icon(0).pixmap(16));
			pDrag->setHotSpot(QPoint(-4, -12));
			pDrag->exec(Qt::LinkAction);
			// We've dragged and maybe dropped it by now...
			// QTreeWidget::reset();
			QTreeWidget::setSelectionMode(
				QAbstractItemView::ExtendedSelection);
			dragLeaveEvent(NULL);
			m_pDragItem = NULL;
		}
	}
}
Example #21
0
void DhQSlider::DvhdragLeaveEvent(QDragLeaveEvent* x1) {
  return dragLeaveEvent(x1);
}
Example #22
0
void DhQScrollArea::DvhdragLeaveEvent(QDragLeaveEvent* x1) {
  return dragLeaveEvent(x1);
}