KWidgetsAddons

kacceleratormanager.h
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 kacceleratormanager.h KAcceleratorManager
20 *
21 * KDE Accelerator manager.
22 *
23 * This class can be used to find a valid and working set of
24 * accelerators for any widget.
25 *
26 * @author Matthias Hölzer-Klüpfel <mhk@kde.org>
27 */
28class KWIDGETSADDONS_EXPORT KAcceleratorManager
29{
30public:
31 /**
32 * Manages the accelerators of a widget.
33 *
34 * Call this function on the top widget of the hierarchy you
35 * want to manage. It will fix the accelerators of the child widgets so
36 * there are never duplicate accelerators. It also tries to put
37 * accelerators on as many widgets as possible.
38 *
39 * The algorithm used tries to take the existing accelerators into
40 * account, as well as the class of each widget. Hopefully, the result
41 * is close to what you would assign manually.
42 *
43 * QMenu's are managed dynamically, so when you add or remove entries,
44 * the accelerators are reassigned. If you add or remove widgets to your
45 * toplevel widget, you will have to call manage again to fix the
46 * accelerators.
47 *
48 * @param widget The toplevel widget you want to manage.
49 * @param 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 * These strings will be given higher priority when assigning keyboard accelerators.
66 * @since 5.0
67 */
68 static void addStandardActionNames(const QStringList &names);
69};
70
71#endif // K_ACCELERATORMANAGER_H
KDE Accelerator manager.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:58:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.