Logo Search packages:      
Sourcecode: ktechlab version File versions

void ItemView::dropEvent ( QDropEvent *  event  )  [protected, inherited]

Attempts to create a new CNItem if one was dragged onto the canvas

Definition at line 243 of file itemview.cpp.

References ItemView::mousePosToCanvasPos(), and DocManager::openURL().

{
      removeDragItem();
      
      KURL::List urls;
      if ( KURLDrag::decode( event, urls ) )
      {
            // Then it is URLs that we can decode :)
            const KURL::List::iterator end = urls.end();
            for ( KURL::List::iterator it = urls.begin(); it != end; ++it )
            {
                  DocManager::self()->openURL(*it);
            }
            return;
      }
      
      if ( !QString(event->format()).startsWith("ktechlab/") )
            return;
      
      QString text;
      QDataStream stream( event->encodedData(event->format()), IO_ReadOnly );
      stream >> text;

      // Get a new component item
      p_itemDocument->addItem( text, mousePosToCanvasPos( event->pos() ), true );
      
      setFocus();
}


Generated by  Doxygen 1.6.0   Back to index