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

lupdate broken with forward declared template class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.9.2
    • Tools: Linguist
    • None

      When using this kind of header lupdate complain that it can not guess correctly the fully qualified class namespace for the translations:

      // Header
      namespace MyApp {
      template <typename Model>
      class ModelHelper;
      typedef ModelHelper<class BaseProxyModel> ProxyModel;
      
      class XYZ : public QObject 
      {
          Q_OBJECT
      
      public:
        explicit XYZ(QObject *parent = nullptr);
      };
      } // My App
      
      // Source
      using namespace MyApp;
      
      XYZ::XYZ(QObject *parent)
        : QObject(parent)
      {
        tr("Hello");
      }
      

      changing to this one fix the issue:

      // Header
      namespace MyApp {
      template <typename Model>
      class ModelHelper;
      class BaseProxyModel;
      typedef ModelHelper<BaseProxyModel> ProxyModel;
      
      class XYZ : public QObject 
      {
          Q_OBJECT
      
      public:
        explicit XYZ(QObject *parent = nullptr);
      };
      } // My App
      
      // Source
      using namespace MyApp;
      
      XYZ::XYZ(QObject *parent)
        : QObject(parent)
      {
        tr("Hello");
      }
      

      So the guilty line is typedef ModelHelper<class BaseProxyModel> ProxyModel;

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

            buddenha Oswald Buddenhagen
            filipe.azevedo Filipe Azevedo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes