Merge PR #355: Add paramValue() methods to Action and Event
This commit is contained in:
commit
2c94506867
@ -102,7 +102,7 @@ void Action::setParams(const ParamList ¶ms)
|
|||||||
m_params = params;
|
m_params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the parameter of this Action with a cetrain \a paramTypeId. */
|
/*! Returns the parameter for the given \a paramTypeId. The returned \l{Param} will be invalid if this Action does not have such a \l{Param}. */
|
||||||
Param Action::param(const ParamTypeId ¶mTypeId) const
|
Param Action::param(const ParamTypeId ¶mTypeId) const
|
||||||
{
|
{
|
||||||
foreach (const Param ¶m, m_params) {
|
foreach (const Param ¶m, m_params) {
|
||||||
@ -113,6 +113,17 @@ Param Action::param(const ParamTypeId ¶mTypeId) const
|
|||||||
return Param(ParamTypeId(), QString());
|
return Param(ParamTypeId(), QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the parameter value for the given \a paramTypeId. The returned \l{QVariant} will be null if this Action does not have such a \l{Param}. */
|
||||||
|
QVariant Action::paramValue(const ParamTypeId ¶mTypeId) const
|
||||||
|
{
|
||||||
|
foreach (const Param ¶m, m_params) {
|
||||||
|
if (param.paramTypeId() == paramTypeId) {
|
||||||
|
return param.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
/*! Gives an indication of the origin of this action.
|
/*! Gives an indication of the origin of this action.
|
||||||
Normally a plugin should treat all actions the same. There might be
|
Normally a plugin should treat all actions the same. There might be
|
||||||
rare exceptions tho:
|
rare exceptions tho:
|
||||||
|
|||||||
@ -64,6 +64,7 @@ public:
|
|||||||
ParamList params() const;
|
ParamList params() const;
|
||||||
void setParams(const ParamList ¶ms);
|
void setParams(const ParamList ¶ms);
|
||||||
Param param(const ParamTypeId ¶mTypeId) const;
|
Param param(const ParamTypeId ¶mTypeId) const;
|
||||||
|
QVariant paramValue(const ParamTypeId ¶mTypeId) const;
|
||||||
|
|
||||||
TriggeredBy triggeredBy() const;
|
TriggeredBy triggeredBy() const;
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ void Event::setParams(const ParamList ¶ms)
|
|||||||
m_params = params;
|
m_params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the parameter of this Event with the given \a paramTypeId. */
|
/*! Returns the parameter for the given \a paramTypeId. The returned \l{Param} will be invalid if this Event does not have such a \l{Param}. */
|
||||||
Param Event::param(const ParamTypeId ¶mTypeId) const
|
Param Event::param(const ParamTypeId ¶mTypeId) const
|
||||||
{
|
{
|
||||||
foreach (const Param ¶m, m_params) {
|
foreach (const Param ¶m, m_params) {
|
||||||
@ -109,6 +109,17 @@ Param Event::param(const ParamTypeId ¶mTypeId) const
|
|||||||
return Param(paramTypeId);
|
return Param(paramTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the parameter value for the given \a paramTypeId. The returned \l{QVariant} will be null if this Event does not have such a \l{Param}. */
|
||||||
|
QVariant Event::paramValue(const ParamTypeId ¶mTypeId) const
|
||||||
|
{
|
||||||
|
foreach (const Param ¶m, m_params) {
|
||||||
|
if (param.paramTypeId() == paramTypeId) {
|
||||||
|
return param.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
/*! Returns true if this event is autogenerated by a state change. */
|
/*! Returns true if this event is autogenerated by a state change. */
|
||||||
bool Event::isStateChangeEvent() const
|
bool Event::isStateChangeEvent() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -59,6 +59,7 @@ public:
|
|||||||
ParamList params() const;
|
ParamList params() const;
|
||||||
void setParams(const ParamList ¶ms);
|
void setParams(const ParamList ¶ms);
|
||||||
Param param(const ParamTypeId ¶mTypeId) const;
|
Param param(const ParamTypeId ¶mTypeId) const;
|
||||||
|
QVariant paramValue(const ParamTypeId ¶mTypeId) const;
|
||||||
|
|
||||||
bool operator ==(const Event &other) const;
|
bool operator ==(const Event &other) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user