Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-11426

lupdate does not find strings in operator overloading methods

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.1
    • 4.6.3
    • Tools: Linguist
    • None
    • All
    • c2d6eb9dca7546bbe8d9c6c62db683615e4b23a7

    Description

      lupdate does not find strings in operator overloading methods. My case is a class (QObject descendant), inside a namespace.

      namespace Test
      {
      class MyClass : public QObject
      {
      Q_OBJECT

      public:
      explicit MyClass(QObject *parent = 0) : QObject(parent) { }

      void myMethod();

      MyClass *operator<<(int i);
      };

      This is the .cpp file of this class:

      /*
      TRANSLATOR Test::MyClass
      */

      #include <QProgressDialog>

      #include "test.h"

      using namespace Test;

      void MyClass::myMethod()
      {
      QProgressDialog dialog(tr("Can see this string"),QString(),0,10);

      dialog.exec();
      }

      MyClass *MyClass::operator<<(int i)
      {
      QProgressDialog dialog(tr("Cannot see this string"),QString(),0,10);

      dialog.exec();

      return this;
      }

      The string in "myMethod" is found by lupdate, the one in << operator not.

      lupdate reports:

      lupdate . -ts lupdate_test.ts
      Scanning directory '.'...C:/Qt4Projects/lupdate_bug/test.cpp:20: tr() cannot be
      called without context

      Updating 'lupdate_test.ts'...
      Found 1 source text(s) (1 new and 0 already existing)

      Qt 4.5.3 was the latest version (AFAIK) that didn't have this problem.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            buddenha Oswald Buddenhagen
            becrux Antonio Di Monaco
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes