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

Moc: Parse error for uncommon property names (e.g. 'ä')

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.0
    • Build tools: moc
    • None

    Description

      When writing tests for property names in QML, I stumbled on some MOC errors in qmltc-generated code.

      It seems that MOC cannot process certain property, setter or getter names  in the Q_PROPERTY macro, here some examples:

       

          Q_PROPERTY(int $ WRITE set$ READ $); // this is fine
          // Q_PROPERTY(int ä WRITE set$ READ $); // main.cpp: error: Parse error at "READ"
          Q_PROPERTY(int hä WRITE set$ READ $); // this is fine
          // Q_PROPERTY(int hä2 WRITE setHä READ hä); // error: no member named 'setH' in 'C'
          // Q_PROPERTY(int hä3 WRITE setA READ ä); // main.cpp: error: Parse error at "READ"
          // Q_PROPERTY(int ä WRITE setA READ a); // error: Parse error at "WRITE"
          // Q_PROPERTY(int ä WRITE setÄ READ ä); // error: Parse error at "WRITE"
          // note: \u00E4 is an unicode escape for "ä" in JS + CPP
          // Q_PROPERTY(int \u00E4 WRITE set\u00E4 READ \u00E4); // error: Parse error at "\"
      

      See attached project, uncomment each line seperately to see the error in MOC (or in the C++ compiler when compiling the .moc file in some cases).

       

      Attachments

        Issue Links

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

          Activity

            People

              fabiankosmale Fabian Kosmale
              sami.shalayel Sami Shalayel
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes