PolkitQt-1

polkitqt1-gui-actionbuttons.h
1 /*
2  This file is part of the Polkit-qt project
3  SPDX-FileCopyrightText: 2009 Dario Freddi <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef POLKITQT1_GUI_ACTIONBUTTONS_H
9 #define POLKITQT1_GUI_ACTIONBUTTONS_H
10 
11 #include "polkitqt1-gui-actionbutton.h"
12 
13 namespace PolkitQt1
14 {
15 
16 namespace Gui
17 {
18 
19 class ActionButtonsPrivate;
20 /**
21  * \class ActionButtons polkitqt1-gui-actionbuttons.h ActionButtons
22  * \author Dario Freddi <[email protected]>
23  *
24  * \brief Class used to hold and update a list of QAbstractButtons
25  *
26  * This class is a convenience wrapper around ActionButton that lets
27  * you associate an undefined number of QAbstractButtons with a single
28  * action. Every button will be updated accordingly upon action's properties
29  * changes.
30  *
31  * \see ActionButton
32  */
34 {
35  Q_OBJECT
36  Q_DECLARE_PRIVATE(ActionButtons)
38 
39 public:
40  /**
41  * Constructs a new ActionButton. You need to pass this
42  * constructor an existing list of QAbstractButtons, whose properties
43  * will be modified according to the underlying Action
44  * object. As ActionButtons inherits from Action, you can
45  * define your buttons' behavior right through this wrapper.
46  *
47  * \see Action
48  *
49  * \param buttons the QAbstractButton to associate to this ActionButton
50  * \param actionId the action Id to create the underlying Action
51  * \param parent the parent object
52  */
53  explicit ActionButtons(const QList<QAbstractButton *> &buttons, const QString &actionId = QString(), QObject *parent = nullptr);
54  ~ActionButtons() override;
55 
56  /**
57  * Sets a list of buttons associated to the underlying action.
58  *
59  * \note If you are calling this function, you're probably
60  * changing the buttons list the action is referring to. If this
61  * is the case, please note that Polkit-Qt does not handle
62  * the previous buttons' memory, so you should take care of
63  * deleting them yourself (if needed). You can retrieve it by
64  * using buttons()
65  *
66  * \see buttons
67  *
68  * \param buttons the new buttons associated with the underlying action
69  */
71 
72  /**
73  * Returns the current buttons list
74  *
75  * \return the buttons currently associated with the underlying action
76  */
78 
79  /**
80  * Adds a button to the current button list. The button's properties
81  * will be updated according to the action upon adding.
82  *
83  * \param button the button to add
84  */
86 
87  /**
88  * Removes a button from the current list. Please note that Polkit-Qt
89  * does not handle the removed button's memory, so you should take care of
90  * deleting it yourself (if needed).
91  *
92  * \param button the button to remove
93  */
95 };
96 
97 }
98 
99 }
100 
101 #endif
Q_OBJECTQ_OBJECT
QAbstractButton * button() const
Returns the current button.
QList< QAbstractButton * > buttons() const
Returns the current buttons list.
Class used to hold and update a QAbstractButton.
Class used to hold and update a list of QAbstractButtons.
void setButtons(const QList< QAbstractButton * > &buttons)
Sets a list of buttons associated to the underlying action.
void removeButton(QAbstractButton *button)
Removes a button from the current list.
ActionButtons(const QList< QAbstractButton * > &buttons, const QString &actionId=QString(), QObject *parent=nullptr)
Constructs a new ActionButton.
QString actionId() const
Returns the current action ID.
Namespace wrapping Polkit-Qt classes.
Q_DISABLE_COPY(Class)
void addButton(QAbstractButton *button)
Adds a button to the current button list.
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Jun 26 2022 04:06:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.