Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
ActionButton.h
Go to the documentation of this file.
1#pragma once
2#include <QPushButton>
3#include <misc/global.h>
5
6namespace sf
7{
8
13 : public QPushButton
14 , public ObjectExtension
15{
16 Q_OBJECT
17 Q_PROPERTY(QString action READ getActionByName WRITE setActionByName)
18
19 public:
23 explicit ActionButton(QWidget* parent = nullptr);
24
28 bool isRequiredProperty(const QString& name) override;
29
37 void setAction(QAction* action);
38
44 [[nodiscard]] QAction* getAction() const;
45
51 void setActionByName(const QString& name);
52
57 [[nodiscard]] QString getActionByName() const;
58
64
65 private:
71 void connectAction(QAction* action);
72
76 QAction* _action;
80 QString _actionName;
81};
82
83}// namespace sf
A QPushButton which is associated with an action.
Definition ActionButton.h:15
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
Overridden 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
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10