[PyQt] Re: Help menu and own icon
Christoph Burgmer
chrislb at gmx.de
Thu Apr 17 11:16:16 BST 2008
Am Mittwoch, 16. April 2008 schrieb Christoph Burgmer:
[snip]
> If I do the same it adds a second help menu, and even gives me the "choose
> language" entry, but then "What is..." is missing.
> Well why all the magic when all I want is to set the app icon for the menu
> and let the app image show up in the following dialog? The latter [1]
> funnily doesn't work unless setting the menu with the above method.
>
> 1. There is no such thing like self.menuBar().getMenu() (or in Qt
> terms .menu()), so I ask myself if the above is the only way to solve my
> problem?
> 2. How to avoid 2 menus showing up then?
> 3. The app image not showing up in the "About..." dialog without the magic
> menu setting - is that a bug or a feature?
> 4. Why does KHelpMenu offer different entries compared to the XMLGuiClient
> class? (This maybe is to much for the list, but maybe someone knows.)
I played around a bit and got an answer to 2. My code now looks as follows:
# disable standard help menu
self.setHelpMenuEnabled(False)
# finally build gui
self.setupGUI()
# help menu magic, copied from pykdedocs and extended by bug icon
helpMenu = KHelpMenu(self, KCmdLineArgs.aboutData(), True)
self.menuBar().addMenu(helpMenu.menu())
self.reportBugAction = helpMenu.action(KHelpMenu.menuReportBug)
self.reportBugAction.setIcon(KIcon('tools-report-bug'))
self.aboutAction = helpMenu.action(KHelpMenu.menuAboutApp)
self.aboutAction.setIcon(self._appIcon)
I set the help menu to false before calling setupGUI() and finally add the
help menu bar with setting icons for the "report bug" (otherwise missing)
and "About 'app'" (otherwise 'missing icon'), adding language selection by
giving True to the constructor (missing by default).
Questions 1, 3, 4 still remain though.
Christoph
More information about the PyQt
mailing list