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

Document how to change the style at run-time

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • None

      It is not possible to change the style on the fly, because QQC2 styling is based on QML type registration time file selection, but it is possible to:

      • unload all QML,
      • destroy any existing QQmlEngine instance(s),
      • call qmlClearTypeRegistrations(),
      • call QQuickStyle::setStyle(),
      • and then re-load the QML content so that QQC2 types are re-registered with the new style.

      This process should be clearly documented in QQuickStyle. Preferably, an example should be provided that uses QML Settings to retain the state of the UI, for example.

      It is important to emphasize the warning in the qmlClearTypeRegistrations() docs:

      Do not call this function while a QQmlEngine exists or behavior will be undefined. Any existing QQmlEngines must be deleted before calling this function. This function only affects the application global cache. Delete the QQmlEngine to clear all cached data relating to that engine.

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jpnurmi J-P Nurmi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes