Class used to hold and update a QAbstractButton.
More...
#include <ActionButton>
|
| ActionButton (ActionButtonPrivate &dd, const QString &actionId, QObject *parent=0) |
|
|
ActionButtonPrivate *const | d_ptr |
|
|
enum | State {
None = 0,
SelfBlocked = 1,
Yes = 2,
No = 4,
Auth = 8,
All = 512
} |
|
Class used to hold and update a QAbstractButton.
- Author
- Daniel Nicoletti dantt.nosp@m.i85-.nosp@m.pk@ya.nosp@m.hoo..nosp@m.com.b.nosp@m.r
-
Dario Freddi drf@k.nosp@m.de.o.nosp@m.rg
This class allows you to associate QAbstractButtons (i.e. QPushButton) to a PolicyKit Action. It will update the button properties according to the PolicyKit Action automatically.
- Note
- You should connect the activated() signal to receive a notification when the user clicked the button and gets permission to perform the given action. If you set 'noEnabled' to
true
it will be emitted when PolKitResult is NO.
◆ ActionButton()
PolkitQt1::Gui::ActionButton::ActionButton |
( |
QAbstractButton * |
button, |
|
|
const QString & |
actionId = QString() , |
|
|
QObject * |
parent = 0 |
|
) |
| |
|
explicit |
Constructs a new ActionButton. You need to pass this constructor an existing QAbstractButton, whose properties will be modified according to the underlying Action object. As ActionButton inherits from Action, you can define your button's behavior right through this wrapper.
- See also
- Action
- Parameters
-
button | the QAbstractButton to associate to this ActionButton |
actionId | the action Id to create the underlying Action |
parent | the parent object |
◆ activate
bool PolkitQt1::Gui::ActionButton::activate |
( |
| ) |
|
|
slot |
Connect clicked() signals to this slot. This should be manually done, as in some cases we might want to manually call this. Calling this will emit authorized().
- Note
- This slot is reentrant which is likely to only be a problem if you are creating an interface to setup PolicyKit policies.
-
If you have a checkbox, connect to its' clicked() signal to avoid an infinite loop as this function internally calls setChecked(). You can always use the clicked(bool) signal in this class to connect to here.
- Warning
- if you use this class take care to not call Action::activate otherwise your checkable buttons won't be properly updated.
◆ button()
QAbstractButton * PolkitQt1::Gui::ActionButton::button |
( |
| ) |
const |
Returns the current button
- Returns
- the button currently associated with the underlying action
◆ clicked
void PolkitQt1::Gui::ActionButton::clicked |
( |
QAbstractButton * |
button, |
|
|
bool |
checked = false |
|
) |
| |
|
signal |
Emitted when the abstract button clicked(bool) signal is emitted. This allows you to use qobject_cast<ActionButton *>(sender()) in a slot connected to this signal and call activate() on it.
- Note
- you will normally want to connect this signal to the activate slot.
- Parameters
-
button | the button that has been clicked |
checked | the checked state, if applicable. Otherwise false |
◆ setButton()
void PolkitQt1::Gui::ActionButton::setButton |
( |
QAbstractButton * |
button | ) |
|
Sets the button associated to the underlying action.
- Note
- If you are calling this function, you're probably changing the button the action is referring to. If this is the case, please note that Polkit-Qt does not handle the previous button's memory, so you should take care of deleting it yourself (if needed). You can retrieve it by using button()
- See also
- button
- Parameters
-
button | the new button associated with the underlying action |
The documentation for this class was generated from the following files: