mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #314, fromQVariant / location of toQVariant
* renamed fromQVariant to convertFromQVariant, the "from" methods imply the object is changed (fromJson, fromString ..) * implemented fromQVariant - changing the object by QVariant * moved toQVariant into PQ template * free function setFromQVariant
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
#ifndef BLACKMISC_HOTKEYFUNCTION_H
|
||||
#define BLACKMISC_HOTKEYFUNCTION_H
|
||||
|
||||
#include "valueobject.h"
|
||||
#include "propertyindex.h"
|
||||
#include "blackmiscfreefunctions.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -48,18 +49,11 @@ namespace BlackMisc
|
||||
//! Set function
|
||||
void setFunction(const Function &function) { m_function = function; }
|
||||
|
||||
//! \copydoc CValueObject::toQVariant
|
||||
//! \copydoc CValueObject::toQVariant()
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
|
||||
//! \copydoc CValueObject::fromQVariant
|
||||
virtual void fromQVariant(const QVariant &variant) override
|
||||
{
|
||||
Q_ASSERT(variant.canConvert<CHotkeyFunction>());
|
||||
if (variant.canConvert<CHotkeyFunction>())
|
||||
{
|
||||
(*this) = variant.value<CHotkeyFunction>();
|
||||
}
|
||||
}
|
||||
virtual void fromQVariant(const QVariant &variant) override { BlackMisc::setFromQVariant(this, variant); }
|
||||
|
||||
//! \copydoc CValueObject::getValueHash
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
Reference in New Issue
Block a user