KDE 4.5 PyKDE API Reference

- KDE's Python API

# KHelpMenu Class Reference

`from PyKDE4.kdeui import *`

Inherits: QObject

## Detailed Description

Standard KDE help menu with dialog boxes.

This class provides the standard KDE help menu with the default "about" dialog boxes and help entry.

This class is used in KMainWindow so normally you don't need to use this class yourself. However, if you need the help menu or any of its dialog boxes in your code that is not subclassed from KMainWindow you should use this class.

The usage is simple:

     mHelpMenu = new KHelpMenu( this, <someText> );
     kmenubar->addMenu(mHelpMenu->menu() );

or if you just want to open a dialog box:

     mHelpMenu = new KHelpMenu( this, <someText> );
     connect( this, SIGNAL(someSignal()), mHelpMenu,SLOT(aboutKDE()));

IMPORTANT: The first time you use KHelpMenu.menu(), a KMenu object is allocated. Only one object is created by the class so if you call KHelpMenu.menu() twice or more, the same pointer is returned. The class will destroy the popupmenu in the destructor so do not delete this pointer yourself.

The KHelpMenu object will be deleted when its parent is destroyed but you can delete it yourself if you want. The code below will always work.

     MyClass.~MyClass()
     {
       delete mHelpMenu;
     }

Using your own "about application" dialog box:

The standard "about application" dialog box is quite simple. If you need a dialog box with more functionality you must design that one yourself. When you want to display the dialog, you simply need to connect the help menu signal showAboutApplication() to your slot.

     void MyClass.myFunc()
     {
       ..
       KHelpMenu *helpMenu = new KHelpMenu( this );
       connect( helpMenu, SIGNAL(showAboutApplication()),
              this, SLOT(myDialogSlot()));
       ..
     }

     void MyClass.myDialogSlot()
     {
       <activate your custom dialog>
     }

"KDE Help Menu"

Author:
  Espen Sand (espen@kde.org)

## Enumerations
MenuId | { menuHelpContents, menuWhatsThis, menuAboutApp, menuAboutKDE, menuReportBug, menuSwitchLanguage }
## Signals
| showAboutApplication ()
## Methods
| __init__ (self, QWidget parent=0, QString aboutAppText=QString(), bool showWhatsThis=1)
| __init__ (self, QWidget parent, KAboutData aboutData, bool showWhatsThis=1, KActionCollection actions=0)
| aboutApplication (self)
| aboutKDE (self)
QAction | action (self, KHelpMenu.MenuId id)
| appHelpActivated (self)
| contextHelpActivated (self)
KMenu | menu (self)
| reportBug (self)
| switchApplicationLanguage (self)

## Signal Documentation

showAboutApplication | ( |  | ) |

This signal is emitted from aboutApplication() if no "about application" string has been defined. The standard application specific dialog box that is normally activated in aboutApplication() will not be displayed when this signal is emitted.

Signal syntax:
  `QObject.connect(source, SIGNAL("showAboutApplication()"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0,
|  | QString | aboutAppText=QString(),
|  | bool | showWhatsThis=1
| ) |  |  |

Constructor.

Parameters:

  | parent | The parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent.
  | aboutAppText | User definable string that is used in the default application dialog box.
  | showWhatsThis | Decides whether a "Whats this" entry will be added to the dialog.

__init__ | ( | self, |
|  | QWidget | parent,
|  | KAboutData | aboutData,
|  | bool | showWhatsThis=1,
|  | KActionCollection | actions=0
| ) |  |  |

Constructor.

This alternative constructor is mainly useful if you want to overide the standard actions (aboutApplication(), aboutKDE(), helpContents(), reportBug, and optionally whatsThis).

Parameters:

  | parent | The parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent.
  | aboutData | User and app data used in the About app dialog
  | showWhatsThis | Decides whether a "Whats this" entry will be added to the dialog.
  | actions | KActionCollection that is used instead of the standard actions.

aboutApplication | ( |  | self ) |

Opens an application specific dialog box.

The method will try to open the about box using the following steps: - If the showAboutApplication() signal is connected, then it will be called. This means there is an application defined aboutBox. - If the aboutData was set in the constructor a KAboutApplicationDialog will be created. - Else a default about box using the aboutAppText from the constructor will be created.

aboutKDE | ( |  | self ) |

Opens the standard "About KDE" dialog box.

QAction action | ( | self, |
|  | KHelpMenu.MenuId | id
| ) |  |  |

Returns the QAction * associated with the given parameter Will return NULL pointers if menu() has not been called

Parameters:

  | id | The id of the action of which you want to get QAction *

appHelpActivated | ( |  | self ) |

Opens the help page for the application. The application name is used as a key to determine what to display and the system will attempt to open <appName>/index.html.

contextHelpActivated | ( |  | self ) |

Activates What's This help for the application.

KMenu menu | ( |  | self ) |

Returns a popup menu you can use in the menu bar or where you need it.

The returned menu is configured with an icon, a title and menu entries. Therefore adding the returned pointer to your menu is enougth to have access to the help menu.

Note: This method will only create one instance of the menu. If you call this method twice or more the same pointer is returned.

reportBug | ( |  | self ) |

Opens the standard "Report Bugs" dialog box.

switchApplicationLanguage | ( |  | self ) |

Opens the changing default application language dialog box.

## Enumeration Documentation

MenuId

Enumerator:

  menuHelpContents = 0 |
  menuWhatsThis = 1 |
  menuAboutApp = 2 |
  menuAboutKDE = 3 |
  menuReportBug = 4 |
  menuSwitchLanguage = 5 |