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
>
4
#include <
misc/qt/ObjectExtension.h
>
5
6
namespace
sf
7
{
8
12
class
_MISC_CLASS
ActionButton
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
63
void
updateButtonStatusFromAction
();
64
65
private
:
71
void
connectAction(QAction* action);
72
76
QAction* _action;
80
QString _actionName;
81
};
82
83
}
// namespace sf
ObjectExtension.h
sf::ActionButton
A QPushButton which is associated with an action.
Definition
ActionButton.h:15
sf::ActionButton::setActionByName
void setActionByName(const QString &name)
Sets an 'action' by finding it in the parent child list by name. When found the getAction()
sf::ActionButton::ActionButton
ActionButton(QWidget *parent=nullptr)
Standard widget constructor.
sf::ActionButton::getActionByName
QString getActionByName() const
Property handler function to retrieve the actions name.
sf::ActionButton::isRequiredProperty
bool isRequiredProperty(const QString &name) override
Overridden from base class.
sf::ActionButton::updateButtonStatusFromAction
void updateButtonStatusFromAction()
Update the button status depending on a change on the action status. This slot is invoked each time t...
sf::ActionButton::setAction
void setAction(QAction *action)
Set the action owner of this button, that is the action associated to the button. The button is confi...
sf::ActionButton::getAction
QAction * getAction() const
Gets the current associated action. When the action is set by name this value is effected too.
sf::ObjectExtension
Interface class to multiple inherit when the sf::FormWriter class needs to be restricted in writing o...
Definition
ObjectExtension.h:17
global.h
_MISC_CLASS
#define _MISC_CLASS
Definition
misc/global.h:40
sf
Definition
Application.h:10
src
com
misc
qt
ActionButton.h
Generated by
1.9.8