patch.diff

patch - Giuseppe Sucameli, 2010-05-25 03:18 PM

Download (1.11 KB)

View differences:

src/app/legend/qgslegend.cpp (working copy)
363 363

  
364 364
  hideLine();
365 365

  
366
  QTreeWidgetItem *destItem = mDropTarget;
367

  
368 366
  QgsLegendItem* origin = dynamic_cast<QgsLegendItem *>( mItemBeingMoved );
369 367
  mItemBeingMoved = NULL;
370 368
  QModelIndex oldIndex = indexFromItem( origin );
371 369

  
372
  QgsLegendItem* dest = dynamic_cast<QgsLegendItem *>( destItem );
370
  // check if the drop place is valid
371
  QgsLegendItem* dest = NULL;
372
  if ( mDropTarget )
373
  {
374
    dest = dynamic_cast<QgsLegendItem *>( mDropTarget );
375
  }
373 376

  
374 377
  // no change?
375 378
  if ( !dest || !origin || ( dest == origin ) )
......
377 380
    checkLayerOrderUpdate();
378 381
    return;
379 382
  }
383
  
384
  // make sure you are able to drag the item
385
  // to fix #2711, #2528, #2018
386
  QgsLegendItem::DRAG_ACTION action = dest->accept( origin );  
387
  if ( action == QgsLegendItem::NO_ACTION && mDropAction != NO_ACTION )
388
  {
389
    QgsDebugMsg( "Drag NO_ACTION" );
390
    return;
391
  }
380 392

  
381 393
  {
382 394
    // Do the actual move here.