KHelpMenu

#include <KHelpMenu>

Inheritance diagram for KHelpMenu:

Public Types

enum  MenuId {
  menuHelpContents = 0, menuWhatsThis = 1, menuAboutApp = 2, menuAboutKDE = 3,
  menuReportBug = 4, menuSwitchLanguage = 5, menuDonate = 6
}
 

Signals

void showAboutApplication ()
 

Public Slots

void aboutApplication ()
 
void aboutKDE ()
 
void appHelpActivated ()
 
void contextHelpActivated ()
 
void donate ()
 
void reportBug ()
 
void switchApplicationLanguage ()
 

Public Member Functions

 KHelpMenu (QWidget *parent=nullptr, const QString &aboutAppText=QString(), bool showWhatsThis=true)
 
 KHelpMenu (QWidget *parent, const KAboutData &aboutData, bool showWhatsThis=true)
 
 ~KHelpMenu ()
 
QActionaction (MenuId id) const
 
QMenumenu ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

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 QMenu 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>
}
khelpmenu.png
KHelpMenu

KHelpMenu respects Kiosk settings (see the KAuthorized namespace in the KConfig framework). In particular, system administrators can disable items on this menu using some subset of the following configuration:

[KDE Action Restrictions][$i]
actions/help_contents=false
actions/help_whats_this=false
actions/help_report_bug=false
actions/switch_application_language=false
actions/help_about_app=false
actions/help_about_kde=false
Author
Espen Sand (espen[email protected]@kde[email protected].org)

Definition at line 109 of file khelpmenu.h.

Member Enumeration Documentation

Enumerator
menuDonate 
Since
5.24

Definition at line 164 of file khelpmenu.h.

Constructor & Destructor Documentation

KHelpMenu::KHelpMenu ( QWidget parent = nullptr,
const QString aboutAppText = QString(),
bool  showWhatsThis = true 
)
explicit

Constructor.

Parameters
parentThe parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent.
aboutAppTextUser definable string that is used in the default application dialog box.
showWhatsThisDecides whether a "Whats this" entry will be added to the dialog.

Definition at line 80 of file khelpmenu.cpp.

KHelpMenu::KHelpMenu ( QWidget parent,
const KAboutData aboutData,
bool  showWhatsThis = true 
)

Constructor.

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

Parameters
parentThe parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent.
aboutDataUser and app data used in the About app dialog
showWhatsThisDecides whether a "Whats this" entry will be added to the dialog.

Definition at line 90 of file khelpmenu.cpp.

KHelpMenu::~KHelpMenu ( )

Destructor.

Destroys dialogs and the menu pointer retuned by menu

Definition at line 100 of file khelpmenu.cpp.

Member Function Documentation

void KHelpMenu::aboutApplication ( )
slot

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.

Definition at line 237 of file khelpmenu.cpp.

void KHelpMenu::aboutKDE ( )
slot

Opens the standard "About KDE" dialog box.

Definition at line 293 of file khelpmenu.cpp.

QAction * KHelpMenu::action ( MenuId  id) const

Returns the QAction * associated with the given parameter Will return a nullptr if menu() has not been called.

Parameters
idThe id of the action of which you want to get QAction *

Definition at line 204 of file khelpmenu.cpp.

void KHelpMenu::appHelpActivated ( )
slot

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.

Definition at line 232 of file khelpmenu.cpp.

void KHelpMenu::contextHelpActivated ( )
slot

Activates What's This help for the application.

Definition at line 357 of file khelpmenu.cpp.

void KHelpMenu::donate ( )
slot

Opens the donate url.

Since
5.24

Definition at line 323 of file khelpmenu.cpp.

QMenu * KHelpMenu::menu ( )

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.

Definition at line 142 of file khelpmenu.cpp.

void KHelpMenu::reportBug ( )
slot

Opens the standard "Report Bugs" dialog box.

Definition at line 303 of file khelpmenu.cpp.

void KHelpMenu::showAboutApplication ( )
signal

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.

void KHelpMenu::switchApplicationLanguage ( )
slot

Opens the changing default application language dialog box.

Definition at line 313 of file khelpmenu.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:51:16 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.