示例#1
0
/*!
  Activate to emit highlighted().
*/
void QTextBrowser::viewportMouseMoveEvent( QMouseEvent* e)
{
#ifndef QT_NO_DRAGANDDROP
    if ( (e->state() & LeftButton) == LeftButton && !d->buttonDown.isEmpty()  ) {
	if ( ( e->globalPos() - d->lastClick ).manhattanLength() > QApplication::startDragDistance() ) {
	    QUrl url ( context(), d->buttonDown, TRUE );
	    QUriDrag* drag = new QUriDrag( this );
	    drag->setUnicodeUris( url.toString() );
	    drag->drag();
	}
	return;
    }
#endif

    if ( e->state() == 0 ) {
	QString act = anchorAt( e->pos() );
	if (d->highlight != act) {
	    if ( !act.isEmpty() ){
		emit highlighted( act );
		d->highlight = act;
	    }
	    else if ( !d->highlight.isEmpty() ) {
		emit highlighted( QString::null );
		d->highlight = QString::null;
	    }
#ifndef QT_NO_CURSOR
	    viewport()->setCursor( d->highlight.isEmpty()?arrowCursor:pointingHandCursor );
#endif
	}
    }

    QTextView::viewportMouseMoveEvent( e );
}
void TeQtViewsListView::contentsMouseMoveEvent(QMouseEvent* e)
{
	QPoint p( contentsToViewport( e->pos() ) );
    if (leftButtonPressed_)
	{
		QPoint pdif = pressedPosition_ - p;
		if(abs(pdif.x()) > 2 || abs(pdif.y()) > 2)
		{
			drag_ = true;
			leftButtonPressed_ = false;
			if(pressedThemeItem_)
			{
				TeQtCheckListItem *item = (TeQtCheckListItem*)itemAt(p);
				if (item && item->getType() == TeQtCheckListItem::THEME)
				{
	//				clicked(item);
					QUriDrag* ud = new QUriDrag(viewport());
					ud->drag();
				}
			}
		}
    }
	if(drag_ && pressedThemeItem_)
		pressedThemeItem_->setOpen(themeOpen_);
}
示例#3
0
QDragObject *KfindWindow::dragObject()
{
    KURL::List uris;
    QPtrList< QListViewItem > selected = selectedItems();

    // create a list of URIs from selection
    for(uint i = 0; i < selected.count(); i++)
    {
        KfFileLVI *item = (KfFileLVI *)selected.at(i);
        if(item)
        {
            uris.append(item->fileitem.url());
        }
    }

    if(uris.count() <= 0)
        return 0;

    QUriDrag *ud = new KURLDrag(uris, (QWidget *)this, "kfind uridrag");

    const QPixmap *pix = currentItem()->pixmap(0);
    if(pix && !pix->isNull())
        ud->setPixmap(*pix);

    return ud;
}
示例#4
0
/*
void TIconView::contentsMouseMoveEvent(QMouseEvent* event)
{
  if(event->state() && LeftButton)
    {
      int distance = (event->pos() - dragPos).manhattanLength();
      if(distance > QApplication::startDragDistance())
    startDrag();
    }
  // This creates a mouse pointer problem don't do this
  //KIconView::contentsMouseMoveEvent(event);
} //this event causes crashing. commented but no feature lack yet.
*/
void TIconView::startDrag()
{
    if(dragItem)
    {
        QStrList uri;
        uri.append(dragItem->moduleinfo()->fileName().local8Bit());
        QUriDrag* uriDrag = new QUriDrag(uri, this);
        uriDrag->drag();
    }
}
示例#5
0
void DirectoryView::contentsMouseMoveEvent( QMouseEvent* e )
{
    if ( mousePressed && ( presspos - e->pos() ).manhattanLength() > QApplication::startDragDistance() ) {
        mousePressed = FALSE;
        QListViewItem *item = itemAt( contentsToViewport(presspos) );
        if ( item ) {
            QString source = fullPath(item);
            if ( QFile::exists(source) ) {
                QUriDrag* ud = new QUriDrag(viewport());
                ud->setUnicodeUris( source );
                if ( ud->drag() )
                    QMessageBox::information( this, "Drag source",
                                              QString("Delete ")+source, "Not implemented" );
            }
        }
    }
}