[vlmc-devel] [PATCH 2/2] Make SettingsValue emit change(val) when it is initially loaded.

Hugo Beauzée-Luyssen hugo at beauzee.fr
Mon Mar 7 16:51:32 CET 2016


On 03/07/2016 04:49 PM, Yikai Lu wrote:
> ---
>   src/Settings/SettingValue.cpp | 5 +++++
>   src/Settings/SettingValue.h   | 1 +
>   2 files changed, 6 insertions(+)
>
> diff --git a/src/Settings/SettingValue.cpp b/src/Settings/SettingValue.cpp
> index 7f35926..22655a3 100644
> --- a/src/Settings/SettingValue.cpp
> +++ b/src/Settings/SettingValue.cpp
> @@ -52,6 +52,11 @@ SettingValue::set( const QVariant& _val )
>           m_val = val;
>           emit changed( m_val );
>       }
> +    else if ( m_initLoad )
> +    {
> +        emit changed( m_val );
> +        m_initLoad = false;
> +    }
>   }
>
>   const QVariant&
> diff --git a/src/Settings/SettingValue.h b/src/Settings/SettingValue.h
> index 60f1bea..309c369 100644
> --- a/src/Settings/SettingValue.h
> +++ b/src/Settings/SettingValue.h
> @@ -130,6 +130,7 @@ class   SettingValue : public QObject
>           Flags           m_flags;
>           QVariant        m_min;
>           QVariant        m_max;
> +        bool            m_initLoad  = true;

While this is ok since we now require C++11, I'd prefer we keep all the 
initializations in the same place.
I'll probably need to update the HACKING guide to reflect some C++11 things

>       signals:
>           /**
>            * \brief This signal is emmited while the m_val
>

Looks good otherwise, thanks!


More information about the Vlmc-devel mailing list