Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PySide 6.7.3 (Mac): Missing icons in menus and context menus
QtWS25 Last Chance

PySide 6.7.3 (Mac): Missing icons in menus and context menus

Scheduled Pinned Locked Moved Solved Qt for Python
10 Posts 3 Posters 764 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bohning
    wrote on 22 Oct 2024, 13:04 last edited by bohning
    #1

    I am using Pyside 6.7.3 and have several actions with icons attached to them, e.g.
    6bd010a7-1526-4133-a208-03c13acb7ec4-image.png
    However, the icons are missing in the app, both in the menu as well as in the context menu:
    fac4e28b-2b64-4ce0-8f50-38659dd0da91-image.png

    This only happens on Mac, the icons are not missing when running the app on Windows. This also happens with 6.8.0 and I think also with 6.8.0.1.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TT-MS
      wrote on 29 Oct 2024, 09:11 last edited by
      #8

      I think I now found it... looks like a feature. See Release Notes Qt 6.7.3:
      "a2aa1f81a81 Determine Qt::AA_DontShowIconsInMenus default value based on platform The default value of Qt::AA_DontShowIconsInMenus is now determined based on the platform. On macOS icons will not show by default. To override, use QAction.iconVisibleInMenu for individual menu actions, or set Qt::AA_DontShowIconsInMenus to false."

      B 1 Reply Last reply 30 Oct 2024, 12:04
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 22 Oct 2024, 16:32 last edited by
        #2

        Hi,

        Where are you loading the images from ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bohning
          wrote on 22 Oct 2024, 16:48 last edited by
          #3

          Hi,
          from the resources.qrc. Other icons in the MainWindow work just fine, only the ones in the menus seem to be affected:
          image.png

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bohning
            wrote on 22 Oct 2024, 17:17 last edited by
            #4

            Also works just fine in the menus with 6.7.2:
            image.png

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 22 Oct 2024, 18:59 last edited by
              #5

              Can you provide a minimal project that shows this issue ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bohning
                wrote on 22 Oct 2024, 19:39 last edited by
                #6

                It also fails if the icon files are used directly, without the resources.qrc.

                import sys
                
                from PySide6.QtGui import QAction, QIcon
                from PySide6.QtWidgets import QApplication, QMainWindow, QMenu
                
                
                class MainWindow(QMainWindow):
                    def __init__(self) -> None:
                        super().__init__()
                
                        menu_bar = self.menuBar()
                
                        file_menu = QMenu("&File", self)
                        menu_bar.addMenu(file_menu)
                
                        new_action = QAction(QIcon("./src/new.png"), "New", self)
                        open_action = QAction(QIcon("./src/open.png"), "Open", self)
                        save_action = QAction(QIcon("./src/save.png"), "Save", self)
                
                        file_menu.addAction(new_action)
                        file_menu.addAction(open_action)
                        file_menu.addAction(save_action)
                
                
                if __name__ == "__main__":
                    app = QApplication(sys.argv)
                
                    window = MainWindow()
                    window.show()
                
                    sys.exit(app.exec())
                

                works with 6.7.2:
                035f9e43-e77c-4601-a6c6-91c9122bb1bb-image.png
                but fails with 6.7.3:
                01ef8092-4800-4c4a-9531-442e2eff93cf-image.png

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  TT-MS
                  wrote on 29 Oct 2024, 08:54 last edited by
                  #7

                  I get the exact same issue (missing icons in menus), without PyQt, but with Qt 6.7.3 in any QWidget based application, on macOS. Using Qt 6.7.2 the menu icons are visible.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    TT-MS
                    wrote on 29 Oct 2024, 09:11 last edited by
                    #8

                    I think I now found it... looks like a feature. See Release Notes Qt 6.7.3:
                    "a2aa1f81a81 Determine Qt::AA_DontShowIconsInMenus default value based on platform The default value of Qt::AA_DontShowIconsInMenus is now determined based on the platform. On macOS icons will not show by default. To override, use QAction.iconVisibleInMenu for individual menu actions, or set Qt::AA_DontShowIconsInMenus to false."

                    B 1 Reply Last reply 30 Oct 2024, 12:04
                    1
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 29 Oct 2024, 20:28 last edited by
                      #9

                      Thanks for the feedback !

                      And sorry for the late reply, I missed your answer. Your deduction looks correct.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • T TT-MS
                        29 Oct 2024, 09:11

                        I think I now found it... looks like a feature. See Release Notes Qt 6.7.3:
                        "a2aa1f81a81 Determine Qt::AA_DontShowIconsInMenus default value based on platform The default value of Qt::AA_DontShowIconsInMenus is now determined based on the platform. On macOS icons will not show by default. To override, use QAction.iconVisibleInMenu for individual menu actions, or set Qt::AA_DontShowIconsInMenus to false."

                        B Offline
                        B Offline
                        bohning
                        wrote on 30 Oct 2024, 12:04 last edited by
                        #10

                        @TT-MS Ah, it's a feature! Thanks for the info, that helps!

                        1 Reply Last reply
                        0
                        • B bohning has marked this topic as solved on 30 Oct 2024, 12:14

                        6/10

                        22 Oct 2024, 19:39

                        • Login

                        • Login or register to search.
                        6 out of 10
                        • First post
                          6/10
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved