Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
ActionButton.h
Go to the documentation of this file.
1#pragma once
2#include <QAction>
3#include <QPushButton>
4#include <QtUiPlugin/QDesignerExportWidget>
6
7namespace sf
8{
9
13class QDESIGNER_WIDGET_EXPORT ActionButton
14 : public QPushButton
15 , public ObjectExtension
16{
17 Q_OBJECT
18 Q_PROPERTY(QString action READ getActionByName WRITE setActionByName)
19
20 public:
24 explicit ActionButton(QWidget* parent = nullptr);
25
29 bool isRequiredProperty(const QString& name) override;
30
38 void setAction(QAction* action);
39
45 [[nodiscard]] QAction* getAction() const;
46
52 void setActionByName(const QString& name);
53
58 [[nodiscard]] QString getActionByName() const;
59
65
66 private:
72 void connectAction(QAction* action);
73
77 QAction* _action;
81 QString _actionName;
82};
83
84}// namespace sf
A QPushButton which is associated with an action.
Definition ActionButton.h:16
void setActionByName(const QString &name)
Sets an 'action' by finding it in the parent child list by name. When found the getAction()
ActionButton(QWidget *parent=nullptr)
Standard widget constructor.
QString getActionByName() const
Property handler function to retrieve the actions name.
bool isRequiredProperty(const QString &name) override
Overloaded from base class.
void updateButtonStatusFromAction()
Update the button status depending on a change on the action status. This slot is invoked each time t...
void setAction(QAction *action)
Set the action owner of this button, that is the action associated to the button. The button is confi...
QAction * getAction() const
Gets the current associated action. When the action is set by name this value is effected too.
Interface class to multiple inherit when the sf::FormWriter class needs to be restricted in writing o...
Definition ObjectExtension.h:17
Definition Application.h:10