PolkitQt-1

polkitqt1-gui-actionbuttons.h
1/*
2 This file is part of the Polkit-qt project
3 SPDX-FileCopyrightText: 2009 Dario Freddi <drf@kde.org>
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
13namespace PolkitQt1
14{
15
16namespace Gui
17{
18
19class ActionButtonsPrivate;
20/**
21 * \class ActionButtons polkitqt1-gui-actionbuttons.h ActionButtons
22 * \author Dario Freddi <drf@kde.org>
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{
36 Q_DECLARE_PRIVATE(ActionButtons)
37 Q_DISABLE_COPY(ActionButtons)
38
39public:
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
Class used to hold and update a QAbstractButton.
QAbstractButton * button() const
Returns the current button.
Class used to hold and update a list of QAbstractButtons.
QList< QAbstractButton * > buttons() const
Returns the current buttons list.
void addButton(QAbstractButton *button)
Adds a button to the current button list.
void removeButton(QAbstractButton *button)
Removes a button from the current list.
void setButtons(const QList< QAbstractButton * > &buttons)
Sets a list of buttons associated to the underlying action.
ActionButtons(const QList< QAbstractButton * > &buttons, const QString &actionId=QString(), QObject *parent=nullptr)
Constructs a new ActionButton.
QString actionId() const
Returns the current action ID.
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:57:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.