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

Make the "reason" parameter to the register*Uncreatable* functions default to a generic message in Qt 6

    XMLWordPrintable

Details

    Description

      This would affect the following functions:

      Within these functions, we can check if the reason argument is empty, and if so, provide a default message that basically says:

      Foo cannot be created in QML.

      My reasoning behind wanting to do this is that most people are going to use similar variations of the same message, and if you have a lot of types to register, it gets messy quickly:

          qmlRegisterUncreatableType<Foo>("QmlTypes", 1, 0, "Foo", "Foo should not be created in QML");
          qmlRegisterUncreatableType<Bar>("QmlTypes", 1, 0, "Bar", "Bar should not be created in QML");
          qmlRegisterUncreatableType<Baz>("QmlTypes", 1, 0, "Baz", "Baz is an enum");
          // and so on
      

      It would be much nicer if the user could just use the default and override when necessary:

          qmlRegisterUncreatableType<Foo>("QmlTypes", 1, 0, "Foo");
          qmlRegisterUncreatableType<Bar>("QmlTypes", 1, 0, "Bar");
          qmlRegisterUncreatableType<Baz>("QmlTypes", 1, 0, "Baz", "Baz is an enum");
      

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes