Ejemplo n.º 1
0
void MrmlViewItem::mouseMoveEvent( QMouseEvent *e )
{
    if ( hitsPixmap( e->pos() ) ) {
        if ( !ownCursor() ) { // nice hacklet :)
            setCursor( KCursor::handCursor() );
            emit view()->onItem( m_url );
        }
    }
    else {
        if ( ownCursor() ) {
            unsetCursor();
            emit view()->onItem( KURL() );
        }
    }

    if ( (e->state() & LeftButton) && !pressedPos.isNull() ) {
        QPoint dist = e->pos() - pressedPos;
        if ( dist.manhattanLength() > KGlobalSettings::dndEventDelay() ) {
            // start drag here
            KURL::List urls;
            // ### support multiple files?
            urls.append( m_url );
            KURLDrag *drag = new KURLDrag( urls, this );
            drag->setPixmap( KMimeType::pixmapForURL( m_url ) );
            drag->drag();
        }
    }
}
Ejemplo n.º 2
0
void QuickButton::mouseMoveEvent(QMouseEvent *e)
{
    if((e->state() & LeftButton) == 0)
        return;
    QPoint p(e->pos() - _dragPos);
    if(p.manhattanLength() <= KGlobalSettings::dndEventDelay())
        return;
    DEBUGSTR << "dragstart" << endl << flush;
    setDown(false);
    if(_dragEnabled)
    {
        KURL::List uris;
        uris.append(_qurl->kurl());
        DEBUGSTR << "creating KURLDrag" << endl << flush;
        KURLDrag *dd = new KURLDrag(uris, this);
        dd->setPixmap(_icon); // PIX
        DEBUGSTR << "ready to drag" << endl << flush;
        grabKeyboard();
        dd->drag();
        releaseKeyboard();
    }
    else
    {
        setCursor(Qt::ForbiddenCursor);
    }
}
Ejemplo n.º 3
0
void PanelBrowserMenu::mouseMoveEvent(QMouseEvent *e)
{
    QPopupMenu::mouseMoveEvent(e);

    if (!(e->state() & LeftButton)) return;
    if(_lastpress == QPoint(-1, -1)) return;

    // DND delay
    if((_lastpress - e->pos()).manhattanLength() < 12) return;

    // get id
    int id = idAt(_lastpress);
    if(!_filemap.contains(id)) return;

    // reset _lastpress
    _lastpress = QPoint(-1, -1);

    // start drag
    KURL url;
    url.setPath(path() + "/" + _filemap[id]);
    KURL::List files(url);
    KURLDrag *d = new KURLDrag(files, this);
    connect(d, SIGNAL(destroyed()), this, SLOT(slotDragObjectDestroyed()));
    d->setPixmap(iconSet(id)->pixmap());
    d->drag();
}
Ejemplo n.º 4
0
void KMMimePartTree::startDrag()
{
    KURL::List urls;
    KMMimePartTreeItem *item = static_cast<KMMimePartTreeItem*>( currentItem() );
    if ( !item ) return;
    partNode *node = item->node();
    if ( !node ) return;
    KURL url = mReaderWin->tempFileUrlFromPartNode( node );
    if (!url.isValid() ) return;
    urls.append( url );
    KURLDrag* drag = new KURLDrag( urls, this );
    drag->drag();
}
void BookmarksListBox::startDrag()
{
    int currentItem = QListBox::currentItem();
    if (currentItem != -1) {
        BookmarkItem* bookmark = (BookmarkItem*)item(currentItem);
	if (bookmark!=0){
            KURL::List lst;
            lst.append( bookmark->url() );
            KURLDrag *drag = new KURLDrag(lst, this);
            drag->drag();
        }
    }
}