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

Import alias leads to 'Type not found'

    XMLWordPrintable

    Details

    • Commits:
      8a9607acfc (qt/qtdeclarative/dev) f3446ed36b (qt/qtdeclarative/6.3)

      Description

      Using import ... as instead of import

      import ui as Test
      
      Window {
          id: window
          property int state
      
          Component.onCompleted: {
              console.log(Test.WindowState.TILT)
              window.state = Test.WindowState.OPEN
              console.log(window.state)
          }
      }
      

      leads to compiler warnings

       

      Warning: main.qml:15:26: Type not found in namespace
              console.log(Test.WindowState.TILT)
                               ^^^^^^^^^^^
      Warning: main.qml:15:26: Property "WindowState" not found on type "Window"
              console.log(Test.WindowState.TILT)
                               ^^^^^^^^^^^
      Warning: main.qml:15:26: Could not compile binding for onCompleted: Cannot load property WindowState from import namespace 2.
              console.log(Test.WindowState.TILT)
                               ^^^^^^^^^^^
      

      , the result works, though. These messages are gone, if you remove Test.

       

      Additionally: why isn't it possible to use something like

      property WindowState state

      ?

        Attachments

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

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            cajus Cajus Pollmeier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes