KHelpMenu

Search for usage in LXR

#include <KHelpMenu>

Inheritance diagram for KHelpMenu:

Public Types

enum  MenuId {
  menuHelpContents = 0 , menuWhatsThis = 1 , menuAboutApp = 2 , menuAboutKDE = 3 ,
  menuReportBug = 4 , menuSwitchLanguage = 5 , menuDonate = 6
}
 
- Public Types inherited from QObject
typedef  QObjectList
 

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, const KAboutData &aboutData)
 
 KHelpMenu (QWidget *parent, const KAboutData &aboutData, bool showWhatsThis)
 
 KHelpMenu (QWidget *parent, const QString &unused, bool showWhatsThis=true)
 
 KHelpMenu (QWidget *parent=nullptr)
 
 ~KHelpMenu () override
 
QActionaction (MenuId id) const
 
QMenumenu ()
 
void setShowWhatsThis (bool showWhatsThis)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
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_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 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
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, 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 *context, Functor functor, 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)
 
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, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- 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 );
kmenubar->addMenu(mHelpMenu->menu() );
KHelpMenu(QWidget *parent, const QString &unused, bool showWhatsThis=true)
Constructor.
Definition khelpmenu.cpp:76

or if you just want to open a dialog box:

mHelpMenu = new KHelpMenu( this );
connect(this, &ClassFoo::someSignal, mHelpMenu, &KHelpMenu::aboutKDE);
void aboutKDE()
Opens the standard "About KDE" dialog box.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)

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, &KHelpMenu::showAboutApplication, this, &ClassFoo:myDialogSlot);
..
}
void MyClass::myDialogSlot()
{
<activate your custom dialog>
}
Standard KDE help menu with dialog boxes.
Definition khelpmenu.h:109
void showAboutApplication()
This signal is emitted from aboutApplication() if no "about application" string has been defined.
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.nosp@m.@kde.nosp@m..org)

Definition at line 108 of file khelpmenu.h.

Member Enumeration Documentation

◆ MenuId

Enumerator
menuDonate 
Since
5.24

Definition at line 201 of file khelpmenu.h.

Constructor & Destructor Documentation

◆ KHelpMenu() [1/4]

KHelpMenu::KHelpMenu ( QWidget * parent,
const QString & unused,
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.
unusedThis value is unused.
showWhatsThisDecides whether a "What's this" entry will be added to the dialog.
Deprecated
Since 6.9, use one of the other constructors

Definition at line 76 of file khelpmenu.cpp.

◆ KHelpMenu() [2/4]

KHelpMenu::KHelpMenu ( QWidget * parent = nullptr)
explicit

Creates a KHelpMenu with the default app data (KAboutData::applicationData()).

Parameters
parentThe parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent.
Since
6.9

Definition at line 85 of file khelpmenu.cpp.

◆ KHelpMenu() [3/4]

KHelpMenu::KHelpMenu ( QWidget * parent,
const KAboutData & aboutData,
bool showWhatsThis )

Constructor.

This alternative constructor is mainly useful if you want to override 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 "What's this" entry will be added to the dialog.
Deprecated
Since 6.9, use one of the other constructors

Definition at line 94 of file khelpmenu.cpp.

◆ KHelpMenu() [4/4]

KHelpMenu::KHelpMenu ( QWidget * parent,
const KAboutData & aboutData )

Creates a KHelpMenu with app data aboutData.

This constructor is useful if you want to use the help menu with custom application data.

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 and for the actions in the help menu.
Since
6.9

Definition at line 104 of file khelpmenu.cpp.

◆ ~KHelpMenu()

KHelpMenu::~KHelpMenu ( )
override

Destructor.

Destroys dialogs and the menu pointer returned by menu

Definition at line 113 of file khelpmenu.cpp.

Member Function Documentation

◆ aboutApplication

void KHelpMenu::aboutApplication ( )
slot

Opens an application specific dialog box.

The method will try to open the about box using the following steps:

Definition at line 251 of file khelpmenu.cpp.

◆ aboutKDE

void KHelpMenu::aboutKDE ( )
slot

Opens the standard "About KDE" dialog box.

Definition at line 264 of file khelpmenu.cpp.

◆ action()

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 218 of file khelpmenu.cpp.

◆ appHelpActivated

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 246 of file khelpmenu.cpp.

◆ contextHelpActivated

void KHelpMenu::contextHelpActivated ( )
slot

Activates What's This help for the application.

Definition at line 329 of file khelpmenu.cpp.

◆ donate

void KHelpMenu::donate ( )
slot

Opens the donate url.

Since
5.24

Definition at line 291 of file khelpmenu.cpp.

◆ menu()

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 enough 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 159 of file khelpmenu.cpp.

◆ reportBug

void KHelpMenu::reportBug ( )
slot

Opens the standard "Report Bugs" dialog box.

Definition at line 273 of file khelpmenu.cpp.

◆ setShowWhatsThis()

void KHelpMenu::setShowWhatsThis ( bool showWhatsThis)

Set whether to show the What's This menu entry in the help menu.

The default is to show the menu entry (if Kiosk settings allow it).

Since
6.9

Definition at line 118 of file khelpmenu.cpp.

◆ showAboutApplication

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.

◆ switchApplicationLanguage

void KHelpMenu::switchApplicationLanguage ( )
slot

Opens the changing default application language dialog box.

Definition at line 282 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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.