1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2002 Matthias Hölzer-Klüpfel <mhk@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef K_ACCELERATORMANAGER_H
9#define K_ACCELERATORMANAGER_H
10
11#include <kwidgetsaddons_export.h>
12
13#include <QStringList>
14
15class QWidget;
16class QString;
17
18/*!
19 * \class KAcceleratorManager
20 * \inmodule KWidgetsAddons
21 *
22 * \brief KDE Accelerator manager.
23 *
24 * This class can be used to find a valid and working set of
25 * accelerators for any widget.
26 */
27class KWIDGETSADDONS_EXPORT KAcceleratorManager
28{
29public:
30 /*!
31 * Manages the accelerators of a widget.
32 *
33 * Call this function on the top widget of the hierarchy you
34 * want to manage. It will fix the accelerators of the child widgets so
35 * there are never duplicate accelerators. It also tries to put
36 * accelerators on as many widgets as possible.
37 *
38 * The algorithm used tries to take the existing accelerators into
39 * account, as well as the class of each widget. Hopefully, the result
40 * is close to what you would assign manually.
41 *
42 * QMenu's are managed dynamically, so when you add or remove entries,
43 * the accelerators are reassigned. If you add or remove widgets to your
44 * toplevel widget, you will have to call manage again to fix the
45 * accelerators.
46 *
47 * \a widget The toplevel widget you want to manage.
48 *
49 * \a programmers_mode if true, KAcceleratorManager adds (&) for removed
50 * accels and & before added accels
51 */
52
53 static void manage(QWidget *widget, bool programmers_mode = false);
54
55 /*! \internal returns the result of the last manage operation. */
56 static void last_manage(QString &added, QString &changed, QString &removed);
57
58 /*!
59 * Use this method for a widget (and its children) you want no accels to be set on.
60 */
61 static void setNoAccel(QWidget *widget);
62
63 /*!
64 * Append names to a list of standard action names.
65 *
66 * These strings will be given higher priority when assigning keyboard accelerators.
67 *
68 * \since 5.0
69 */
70 static void addStandardActionNames(const QStringList &names);
71};
72
73#endif // K_ACCELERATORMANAGER_H
74

source code of kwidgetsaddons/src/kacceleratormanager.h