[vlmc-devel] [PATCH 1/2] Fix QTimer running with its interval of 0

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


On 03/07/2016 04:49 PM, Yikai Lu wrote:
> By letting SettingValue "setLimits" and making it Clamped, we avoid it being 0.
>
> Also, have QTimer run with the interval saved as SettingValue, not just start()
> ---
>   src/Project/Project.cpp | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
> index 3800e51..6c36d83 100644
> --- a/src/Project/Project.cpp
> +++ b/src/Project/Project.cpp
> @@ -60,7 +60,8 @@ Project::Project( Settings* settings )
>       SettingValue    *automaticBackupInterval = settings->createVar( SettingValue::Int, "vlmc/AutomaticBackupInterval", 5,
>                                       QT_TRANSLATE_NOOP( "PreferenceWidget", "Automatic save interval" ),
>                                       QT_TRANSLATE_NOOP( "PreferenceWidget", "This is the interval that VLMC will wait "
> -                                                       "between two automatic save" ), SettingValue::Nothing );
> +                                                       "between two automatic save" ), SettingValue::Clamped );
> +    automaticBackupInterval->setLimits(1, QVariant(QVariant::Invalid));
>
>       connect( m_timer, SIGNAL( timeout() ), this, SLOT(autoSaveRequired() ) );
>       connect( this, SIGNAL( destroyed() ), m_timer, SLOT( stop() ) );
> @@ -69,8 +70,6 @@ Project::Project( Settings* settings )
>                this, SLOT( autoSaveEnabledChanged( QVariant ) ) );
>       connect( automaticBackupInterval, SIGNAL( changed( QVariant ) ), this,
>                SLOT( autoSaveIntervalChanged( QVariant ) ) );
> -
> -    m_timer->start();
>   }
>
>   Project::~Project()
>
Applied, thanks!


More information about the Vlmc-devel mailing list