← Back to team overview

ubuntu-sdk-team team mailing list archive

Re: [Merge] lp:~aacid/ubuntu-ui-toolkit/save_stat_loading_already_loaded_image into lp:ubuntu-ui-toolkit/staging

 

Review: Needs Fixing

I have one small request to it, otherwise good.

Diff comments:

> === modified file 'src/UbuntuToolkit/ucqquickimageextension.cpp'
> --- src/UbuntuToolkit/ucqquickimageextension.cpp	2016-09-12 09:03:50 +0000
> +++ src/UbuntuToolkit/ucqquickimageextension.cpp	2017-02-02 14:51:24 +0000
> @@ -61,12 +63,33 @@
>      return m_source;
>  }
>  
> +
>  void UCQQuickImageExtension::setSource(const QUrl& url)
>  {
>      if (url != m_source) {
>          m_source = url;
> +        reloadSourceOrPostEvent();
> +    }
> +}
> +
> +void UCQQuickImageExtension::reloadSourceOrPostEvent()
> +{
> +    // We need to wait until the component is complete
> +    // so that m_image->sourceSize() is actually valid
> +    if (QQuickItemPrivate::get(m_image)->componentComplete) {
>          reloadSource();
> -    }
> +    } else {
> +        qApp->postEvent(this, new QEvent(QEvent::User));

Please register the next event ID and use that.

> +    }
> +}
> +
> +bool UCQQuickImageExtension::event(QEvent *e)
> +{
> +    if (e->type() == QEvent::User) {
> +        reloadSourceOrPostEvent();
> +        return true;
> +    }
> +    return QObject::event(e);
>  }
>  
>  void UCQQuickImageExtension::reloadSource()


-- 
https://code.launchpad.net/~aacid/ubuntu-ui-toolkit/save_stat_loading_already_loaded_image/+merge/316235
Your team Ubuntu SDK team is subscribed to branch lp:ubuntu-ui-toolkit/staging.


References