Thu, 10 Jun 2021 17:10:57 +0200
Changed code to not use 'act.menu()' anymore.
diff -r 32506bc52886 -r ff89f8bac0a5 eric7/EricWidgets/EricModelMenu.py --- a/eric7/EricWidgets/EricModelMenu.py Thu Jun 10 17:08:51 2021 +0200 +++ b/eric7/EricWidgets/EricModelMenu.py Thu Jun 10 17:10:57 2021 +0200 @@ -46,12 +46,21 @@ self.__dropRow = -1 self.__dropIndex = None + self.menuActions = [] + # This is to ensure it will be shown on Mac OS X self.addAction("--not populated--") self.aboutToShow.connect(self.__aboutToShow) self.triggered.connect(self.__actionTriggered) + def clear(self): + """ + Public method to clear the menu. + """ + super().clear() + self.menuActions.clear() + def prePopulated(self): """ Public method to add any actions before the tree. @@ -208,7 +217,8 @@ icon = UI.PixmapCache.getIcon("defaultIcon") modelMenu.setIcon(icon) if parentMenu is not None: - parentMenu.addMenu(modelMenu).setData(v) + self.menuActions.append( + parentMenu.addMenu(modelMenu).setData(v)) modelMenu.setRootIndex(parent) modelMenu.setModel(self.__model) return
diff -r 32506bc52886 -r ff89f8bac0a5 eric7/WebBrowser/Bookmarks/BookmarksMenu.py --- a/eric7/WebBrowser/Bookmarks/BookmarksMenu.py Thu Jun 10 17:08:51 2021 +0200 +++ b/eric7/WebBrowser/Bookmarks/BookmarksMenu.py Thu Jun 10 17:10:57 2021 +0200 @@ -155,10 +155,9 @@ """ act = self.actionAt(pos) - # TODO: change this to not use act.menu() if ( act is not None and - act.menu() is None and + act not in self.menuActions and self.index(act).isValid() ): menu = QMenu()
diff -r 32506bc52886 -r ff89f8bac0a5 eric7/WebBrowser/Bookmarks/BookmarksToolBar.py --- a/eric7/WebBrowser/Bookmarks/BookmarksToolBar.py Thu Jun 10 17:08:51 2021 +0200 +++ b/eric7/WebBrowser/Bookmarks/BookmarksToolBar.py Thu Jun 10 17:10:57 2021 +0200 @@ -82,8 +82,8 @@ if act is not None: v = act.data() - # TODO: change this to not use act.menu() - if act.menu() is None: + button = self.widgetForAction(act) + if button.menu() is None: act2 = menu.addAction(self.tr("Open")) act2.setData(v) act2.triggered.connect(