From 8c6ac0aeeca8660122ce58cefe333588713de26b Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sat, 10 Oct 2026 20:27:01 +1300 Subject: [PATCH] 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 --- sources/imagedrop.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sources/imagedrop.cpp b/sources/imagedrop.cpp index 06aa5ed85..76ac259d6 100644 --- a/sources/imagedrop.cpp +++ b/sources/imagedrop.cpp @@ -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; }