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

dot-import documentation is very incomplete.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.9.0
    • Documentation
    • None

      The lacking documentation caused me to post this StackOverflow question.

      The relevant documentation is here.

      It seems to imply that the standard - and only - way to import a QML type from JS is with .import FileIO 1.0 as FileIO. But it doesn't mention that - unlike the standard way of importing in QML with import FileIO 1.0 (no leading dot) - you need to use the imported type with a prefix - FileIO.FileIO.readAll(). Nor does it mention that the "{{ as FileIO}}" suffix of the .import statement can be dropped, leading to the simpler usage syntax FileIO.readAll().

      It would be good to have these two things mentioned. They're not at all obvious, since they're documented for importing QML from QML, but not for importing QML from JS. More so because the two import cases use different syntax otherwise - one has a leading dot, the other doesn't.

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

            docteam Qt Documentation Team
            stefan_monov Stefan Monov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes