Skip to content
Permalink
Browse files

Allow drag&drop with multiple files

  • Loading branch information
wonder-sk committed Jul 28, 2011
1 parent 68816cd commit d76a0e4d56ba833bbc44c3976db16631d7aaa6d2
Showing with 19 additions and 15 deletions.
  1. +18 −15 src/app/qgisapp.cpp
  2. +1 −0 src/app/qgsbrowserdockwidget.cpp
@@ -668,23 +668,26 @@ void QgisApp::dropEvent( QDropEvent *event )
QByteArray encodedData = event->mimeData()->data( "application/x-vnd.qgis.qgis.uri" );
QDataStream stream( &encodedData, QIODevice::ReadOnly );
QString xUri; // extended uri: layer_type:provider_key:uri
stream >> xUri;
QgsDebugMsg( xUri );
QRegExp rx( "^([^:]+):([^:]+):([^:]+):(.+)" );
if ( rx.indexIn( xUri ) != -1 )
while ( !stream.atEnd() )
{
QString layerType = rx.cap( 1 );
QString providerKey = rx.cap( 2 );
QString name = rx.cap( 3 );
QString uri = rx.cap( 4 );
QgsDebugMsg( "type: " + layerType + " key: " + providerKey + " name: " + name + " uri: " + uri );
if ( layerType == "vector" )
stream >> xUri;
QgsDebugMsg( xUri );
QRegExp rx( "^([^:]+):([^:]+):([^:]+):(.+)" );
if ( rx.indexIn( xUri ) != -1 )
{
addVectorLayer( uri, name, providerKey );
}
else if ( layerType == "raster" )
{
addRasterLayer( uri, name, providerKey, QStringList(), QStringList(), QString(), QString() );
QString layerType = rx.cap( 1 );
QString providerKey = rx.cap( 2 );
QString name = rx.cap( 3 );
QString uri = rx.cap( 4 );
QgsDebugMsg( "type: " + layerType + " key: " + providerKey + " name: " + name + " uri: " + uri );
if ( layerType == "vector" )
{
addVectorLayer( uri, name, providerKey );
}
else if ( layerType == "raster" )
{
addRasterLayer( uri, name, providerKey, QStringList(), QStringList(), QString(), QString() );
}
}
}
}
@@ -17,6 +17,7 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
mBrowserView = new QTreeView( this );
mBrowserView->setDragEnabled( true );
mBrowserView->setDragDropMode( QTreeView::DragOnly );
mBrowserView->setSelectionMode( QAbstractItemView::ExtendedSelection );
setWidget( mBrowserView );

//connect( mBrowserView, SIGNAL( clicked( const QModelIndex& ) ), this, SLOT( itemClicked( const QModelIndex& ) ) );

0 comments on commit d76a0e4

Please sign in to comment.
You can’t perform that action at this time.