diff --git a/src/app/layout/qgslayoutimagedrophandler.cpp b/src/app/layout/qgslayoutimagedrophandler.cpp index b575f6f689c..cc20aca855b 100644 --- a/src/app/layout/qgslayoutimagedrophandler.cpp +++ b/src/app/layout/qgslayoutimagedrophandler.cpp @@ -50,7 +50,6 @@ bool QgsLayoutImageDropHandler::handleFileDrop( QgsLayoutDesignerInterface *ifac std::unique_ptr< QgsLayoutItemPicture > item = qgis::make_unique< QgsLayoutItemPicture >( iface->layout() ); QgsLayoutPoint layoutPoint = iface->layout()->convertFromLayoutUnits( point, iface->layout()->units() ); - item->attemptMove( layoutPoint ); item->setPicturePath( file ); @@ -59,6 +58,13 @@ bool QgsLayoutImageDropHandler::handleFileDrop( QgsLayoutDesignerInterface *ifac // and then move back to standard freeform image sizing item->setResizeMode( QgsLayoutItemPicture::Zoom ); + // we want the drop location to be the center of the placed item, because drag thumbnails are usually centered on the mouse cursor + item->setReferencePoint( QgsLayoutItem::Middle ); + item->attemptMove( layoutPoint ); + + // reset to standard top-left reference point location + item->setReferencePoint( QgsLayoutItem::UpperLeft ); + // and auto select new item for convenience QList< QgsLayoutItem * > newSelection; newSelection << item.get();