KConfigWidgets

kcodecaction.h
1/*
2 SPDX-FileCopyrightText: 2003 Jason Keirstead <jason@keirstead.org>
3 SPDX-FileCopyrightText: 2003-2006 Michel Hermier <michel.hermier@gmail.com>
4 SPDX-FileCopyrightText: 2007 Nick Shaforostoff <shafff@ukr.net>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8#ifndef KCODECACTION_H
9#define KCODECACTION_H
10
11#include <kconfigwidgets_export.h>
12
13#include <KSelectAction>
14#include <memory>
15
16/**
17 * @class KCodecAction kcodecaction.h KCodecAction
18 *
19 * @short Action for selecting one of several text codecs..
20 *
21 * This action shows up a submenu with a list of the available codecs on the system.
22 */
23class KCONFIGWIDGETS_EXPORT KCodecAction : public KSelectAction
24{
25 Q_OBJECT
26
27 Q_PROPERTY(QString codecName READ currentCodecName WRITE setCurrentCodec)
28
29public:
30 explicit KCodecAction(QObject *parent, bool showAutoOptions = false);
31
32 KCodecAction(const QString &text, QObject *parent, bool showAutoOptions = false);
33
34 KCodecAction(const QIcon &icon, const QString &text, QObject *parent, bool showAutoOptions = false);
35
36 ~KCodecAction() override;
37
38public:
39 QString currentCodecName() const;
40 bool setCurrentCodec(const QString &codecName);
41
43 /**
44 * Emitted when a codec was selected
45 *
46 * @param name the name of the selected encoding.
47 *
48 * Note that textTriggered(const QString &) is emitted too (as defined in KSelectAction).
49 *
50 * @since 5.103
51 */
52 void codecNameTriggered(const QByteArray &name);
53
54 /**
55 * Emitted when the 'Default' codec action is triggered.
56 */
58
59protected Q_SLOTS:
60 void slotActionTriggered(QAction *) override;
61
62protected:
64
65private:
66 friend class KCodecActionPrivate;
67 std::unique_ptr<class KCodecActionPrivate> const d;
68};
69
70#endif
Action for selecting one of several text codecs.
void defaultItemTriggered()
Emitted when the 'Default' codec action is triggered.
void codecNameTriggered(const QByteArray &name)
Emitted when a codec was selected.
virtual void slotActionTriggered(QAction *action)
void actionTriggered(QAction *action)
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.