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

QUrl: documentation should warn about potential constructor misuse

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Fixed
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.4.3, 6.5.0, 6.6.0
    • None
    • Core: I/O
    • None
    • ce8fc1e88 (dev), d4efc8af9 (6.4), 6e011cd19 (6.5)

      https://stackoverflow.com/a/43619742

       

      Some users of the class might do something like QUrl("example.com") and expect it to fill the host but it actually fills the path due to how URL standard is defined (if there is no scheme, path takes priority to support URLs like [john@example.com|mailto:john@example.com] where the email address is a path and the host is empty). 

       

      While there is no bug in Qt implementation, I think it would be a worthwhile addition to the class documentation to warn users about this potential trap. Maybe add static factory functions, similar to what QString has for different encodings (here: for different elements of the URL).

        For Gerrit Dashboard: QTBUG-109855
        # Subject Branch Project Status CR V

            thiago Thiago Macieira
            michal_urbanski Michał Urbański
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes