From 901de11d1bdab85fb8929cc2a9f7439fba493601 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Sat, 31 Oct 2020 09:58:33 +0100 Subject: [PATCH] avoid initial warnings with empty sizes --- playground/images/Image.cpp | 6 ++++++ playground/images/Image.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/playground/images/Image.cpp b/playground/images/Image.cpp index 6fe4b254..a72b1420 100644 --- a/playground/images/Image.cpp +++ b/playground/images/Image.cpp @@ -90,6 +90,12 @@ bool Image::deferredUpdates() const return m_data->deferredUpdates; } +void Image::setSourceSize( const QSize& size ) +{ + if ( size.isEmpty() != sourceSize().isEmpty() ) + QQuickImage::setSourceSize( size ); +} + void Image::componentComplete() { if ( m_data->deferredUpdates && m_data->sourceSizeAdjustment ) diff --git a/playground/images/Image.h b/playground/images/Image.h index 30d4e75a..d5997e14 100644 --- a/playground/images/Image.h +++ b/playground/images/Image.h @@ -49,6 +49,8 @@ class Image : public QQuickImage Q_INVOKABLE virtual bool hasWidthForHeight() const; Q_INVOKABLE virtual qreal widthForHeight( qreal height ) const; + void setSourceSize( const QSize& ) override; + public Q_SLOTS: void show(); void hide();