avoid initial warnings with empty sizes

This commit is contained in:
Uwe Rathmann 2020-10-31 09:58:33 +01:00
parent b004e6d8d5
commit 901de11d1b
2 changed files with 8 additions and 0 deletions

View File

@ -90,6 +90,12 @@ bool Image::deferredUpdates() const
return m_data->deferredUpdates; return m_data->deferredUpdates;
} }
void Image::setSourceSize( const QSize& size )
{
if ( size.isEmpty() != sourceSize().isEmpty() )
QQuickImage::setSourceSize( size );
}
void Image::componentComplete() void Image::componentComplete()
{ {
if ( m_data->deferredUpdates && m_data->sourceSizeAdjustment ) if ( m_data->deferredUpdates && m_data->sourceSizeAdjustment )

View File

@ -49,6 +49,8 @@ class Image : public QQuickImage
Q_INVOKABLE virtual bool hasWidthForHeight() const; Q_INVOKABLE virtual bool hasWidthForHeight() const;
Q_INVOKABLE virtual qreal widthForHeight( qreal height ) const; Q_INVOKABLE virtual qreal widthForHeight( qreal height ) const;
void setSourceSize( const QSize& ) override;
public Q_SLOTS: public Q_SLOTS:
void show(); void show();
void hide(); void hide();