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

QIcon::fromTheme fallback regression

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 6.2.3, 6.4
    • GUI: Other
    • None
    • Linux/X11

    Description

      At least when creating a UI file in Designer, specifying the theme name no longer works like it did in Qt 5. See screenshots.

      In qtbase/examples/widgets/richtext/textedit and qtbase/examples/widgets/mainwindows/application (and others), QIcon::fromTheme() is in use. It seems that in both Qt 5 and Qt 6, I get fallback icons rather than theme icons, on my plain X11 desktop. And qtbase/examples/widgets/mainwindows/application has a couple of actions without fallback icons:

      const QIcon saveAsIcon = QIcon::fromTheme("document-save-as");
      const QIcon exitIcon = QIcon::fromTheme("application-exit");
      

      Those do not have icons on the menu, neither in Qt 5 nor in Qt 6. It seems to me that it should choose one, even if I'm not running on KDE or Gnome (fall back to a default theme). Not sure if this issue is related. FWIW /usr/share/icons/hicolor and /usr/share/icons/default do not contain an icon for document-save-as; but other themes do have it. QIcon::themeName() and QIcon::fallbackThemeName() are both "hicolor" (checked by adding a qDebug to tst_QIcon::fromTheme).

      Setting QT_QPA_SYSTEM_ICON_THEME=oxygen is a workaround. But maybe there's a more standard env var to set. I already had GTK_THEME=Vertex:dark.

      Attachments

        1. action-editor-qt5.png
          action-editor-qt5.png
          10 kB
        2. qt5.png
          qt5.png
          174 kB
        3. qt6.png
          qt6.png
          57 kB
        4. screenshot-1.png
          screenshot-1.png
          39 kB
        5. screenshot-2.png
          screenshot-2.png
          11 kB

        Issue Links

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

          Activity

            People

              axelspoerl Axel Spoerl
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes