@@ -2561,10 +2561,13 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
25612561 {
25622562 const QStringList formats = pMimeData->formats ();
25632563 QString selectedFormat;
2564+ UBMimeType::Enum ubMimeType{UBMimeType::UNKNOWN };
25642565
25652566 for (const QString& format : formats)
2566- {
2567- if (format.startsWith (" image/" ))
2567+ {
2568+ ubMimeType = UBFileSystemUtils::mimeTypeFromString (format);
2569+
2570+ if (ubMimeType == UBMimeType::VectorImage || ubMimeType == UBMimeType::RasterImage)
25682571 {
25692572 selectedFormat = format;
25702573 break ;
@@ -2575,22 +2578,32 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
25752578
25762579 if (selectedFormat.isEmpty ())
25772580 {
2581+ // should never happen, but just in case
25782582 // create an image and fill the buffer with PNG data
25792583 QImage img = qvariant_cast<QImage> (pMimeData->imageData ());
25802584 img.save (&buffer, " png" );
2585+ ubMimeType = UBMimeType::RasterImage;
25812586 }
25822587 else
25832588 {
25842589 // get data from mime data
25852590 buffer.setData (pMimeData->data (selectedFormat));
25862591 }
25872592
2588- // validate that the image is really an image, webkit does not fill properly the image mime data
2589- if (!buffer.data ().isEmpty ())
2593+ if (ubMimeType == UBMimeType::VectorImage)
25902594 {
2591- mActiveScene ->addImage (buffer. data (), NULL , pPos, 1 . );
2595+ mActiveScene ->addSvg ({}, pPos, buffer. data () );
25922596 return ;
25932597 }
2598+ else if (ubMimeType == UBMimeType::RasterImage)
2599+ {
2600+ // validate that the image is really an image, webkit does not fill properly the image mime data
2601+ if (!buffer.data ().isEmpty ())
2602+ {
2603+ mActiveScene ->addImage (buffer.data (), nullptr , pPos, 1 .);
2604+ return ;
2605+ }
2606+ }
25942607 }
25952608
25962609 if (pMimeData->hasText ())
0 commit comments