mirror of
https://github.com/YACReader/yacreader
synced 2025-05-25 18:00:46 -04:00
Format
This commit is contained in:
parent
bed3503aae
commit
4adad5f966
@ -116,17 +116,14 @@ QString YACReader::imagePathFromMimeData(const QMimeData *mimeData)
|
||||
{
|
||||
QString filePath;
|
||||
|
||||
// Check for URLs (drag from browser or file explorer)
|
||||
if (mimeData->hasUrls()) {
|
||||
QList<QUrl> urlList = mimeData->urls();
|
||||
|
||||
// We only handle the first URL for simplicity
|
||||
if (!urlList.isEmpty()) {
|
||||
QUrl url = urlList.first();
|
||||
if (url.isLocalFile()) {
|
||||
filePath = url.toLocalFile();
|
||||
|
||||
// Verify it's an image file using the extension
|
||||
QFileInfo fileInfo(filePath);
|
||||
QString extension = fileInfo.suffix().toLower();
|
||||
QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
|
||||
@ -140,7 +137,7 @@ QString YACReader::imagePathFromMimeData(const QMimeData *mimeData)
|
||||
}
|
||||
|
||||
if (!isSupported) {
|
||||
filePath.clear(); // Not a supported image format
|
||||
filePath.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user