KWidgetsAddons

kdualaction.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2010 Aurélien Gâteau <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 #ifndef KDUALACTION_H
8 #define KDUALACTION_H
9 
10 #include <QAction>
11 
12 #include <kwidgetsaddons_export.h>
13 
14 class KDualActionPrivate;
15 class KGuiItem;
16 
49 class KWIDGETSADDONS_EXPORT KDualAction : public QAction
50 {
51  Q_OBJECT
52 public:
57  explicit KDualAction(QObject *parent);
58 
62  KDualAction(const QString &inactiveText, const QString &activeText, QObject *parent);
63 
64  ~KDualAction();
65 
69  void setActiveGuiItem(const KGuiItem &);
70 
74  KGuiItem activeGuiItem() const;
75 
79  void setInactiveGuiItem(const KGuiItem &);
80 
84  KGuiItem inactiveGuiItem() const;
85 
89  void setActiveIcon(const QIcon &);
90 
94  QIcon activeIcon() const;
95 
99  void setInactiveIcon(const QIcon &);
100 
104  QIcon inactiveIcon() const;
105 
109  void setActiveText(const QString &);
110 
114  QString activeText() const;
115 
119  void setInactiveText(const QString &);
120 
124  QString inactiveText() const;
125 
129  void setActiveToolTip(const QString &);
130 
134  QString activeToolTip() const;
135 
139  void setInactiveToolTip(const QString &);
140 
144  QString inactiveToolTip() const;
145 
149  void setIconForStates(const QIcon &icon);
150 
155  bool isActive() const;
156 
161  void setAutoToggle(bool);
162 
167  bool autoToggle() const;
168 
169 public Q_SLOTS:
174  void setActive(bool state);
175 
176 Q_SIGNALS:
181  void activeChanged(bool);
182 
187  void activeChangedByUser(bool);
188 
189 private:
190  Q_PRIVATE_SLOT(d, void slotTriggered())
191  KDualActionPrivate *const d;
192  friend class KDualActionPrivate;
193 };
194 
195 #endif /* KDUALACTION_H */
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:31
An action which can alternate between two texts/icons when triggered.
Definition: kdualaction.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 10 2020 22:47:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.