Fix the lupdate warning on the dropped-picture error texts

lupdate printed "Class 'ImageDrop' lacks Q_OBJECT macro" at
imagedrop.cpp:77 on every "update_translations" run (#1446).
ImageDrop is a namespace, not a class, and the file routed its texts
through a local tr() helper; lupdate reads tr() inside an ImageDrop::
function as a member of a class without Q_OBJECT.

Call QCoreApplication::translate("ImageDrop", ...) directly instead,
which lupdate reads without a class. The context and the four source
texts are unchanged, so the existing translations still apply.

Closes #1446

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-10 20:27:01 +13:00
parent d4352b72c1
commit 8c6ac0aeec
+4 -9
View File
@@ -35,11 +35,6 @@ namespace
const QString suffix = QFileInfo(url.toLocalFile()).suffix().toLower();
return ImageDrop::supportedSuffixes().contains(suffix);
}
QString tr(const char *text)
{
return QCoreApplication::translate("ImageDrop", text);
}
}
QStringList ImageDrop::supportedSuffixes()
@@ -74,18 +69,18 @@ QImage ImageDrop::load(const QString &path, QString *error)
const QFileInfo info(path);
if (!info.isFile())
return fail(tr("not a file"));
return fail(QCoreApplication::translate("ImageDrop", "not a file"));
if (info.size() > maxFileBytes)
return fail(tr("the file is larger than 10 MB"));
return fail(QCoreApplication::translate("ImageDrop", "the file is larger than 10 MB"));
QImageReader reader(path);
const QSize size = reader.size();
if (size.isValid() && qint64(size.width()) * size.height() > maxPixels)
return fail(tr("the image has too many pixels"));
return fail(QCoreApplication::translate("ImageDrop", "the image has too many pixels"));
const QImage image = reader.read();
if (image.isNull())
return fail(tr("unable to read the image"));
return fail(QCoreApplication::translate("ImageDrop", "unable to read the image"));
return image;
}