I developed an app under Windows with PySide6 that works well, except …:
In my toolbar I want a button that opens a short submenu, where you can activate or deactivate some options. The button is shown in the toolbar but the submenu doesn’t open. What’s wrong ???
...
MenuAnsicht = QMenu()
self.MenuAFav = QAction("Favoriten")
self.MenuAFav.setCheckable(True)
self.MenuAFav.setChecked(True)
MenuAnsicht.addAction(self.MenuAFav)
self.MenuARoP = QAction("Receiver ohne Pay-TV")
self.MenuARoP.setCheckable(True)
MenuAnsicht.addAction(self.MenuARoP)
self.MenuARmP = QAction("Receiver mit Pay-TV")
self.MenuARmP.setCheckable(True)
MenuAnsicht.addAction(self.MenuARmP)
tbtnAnsicht = QToolButton()
tbtnAnsicht.setFixedSize(50, 35)
tbtnAnsicht.setToolTip("Ansicht")
tbtnAnsicht.setIcon(QIcon(".\\icons\\iconAnsicht.png"))
tbtnAnsicht.setPopupMode(QToolButton.ToolButtonPopupMode.MenuButtonPopup)
tbtnAnsicht.setMenu(MenuAnsicht)
toolbar.addWidget(tbtnAnsicht)
...