Skip to content

Commit

Permalink
Fix QLabel::pixmap returns a value not a pointer on qt 6
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 27, 2021
1 parent 581cb40 commit 83749c1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/gui/qgsexternalresourcewidget.cpp
Expand Up @@ -142,9 +142,13 @@ void QgsExternalResourceWidget::updateDocumentViewer()

if ( mDocumentViewerContent == Image )
{
const QPixmap *pm = mPixmapLabel->pixmap();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const QPixmap pm = mPixmapLabel->pixmap() ? *mPixmapLabel->pixmap() : QPixmap();
#else
const QPixmap pm = mPixmapLabel->pixmap();
#endif

if ( !pm || pm->isNull() )
if ( !pm || pm.isNull() )
{
mPixmapLabel->setMinimumSize( QSize( 0, 0 ) );
}
Expand All @@ -153,11 +157,11 @@ void QgsExternalResourceWidget::updateDocumentViewer()
QSize size( mDocumentViewerWidth, mDocumentViewerHeight );
if ( size.width() == 0 && size.height() > 0 )
{
size.setWidth( size.height() * pm->size().width() / pm->size().height() );
size.setWidth( size.height() * pm.size().width() / pm.size().height() );
}
else if ( size.width() > 0 && size.height() == 0 )
{
size.setHeight( size.width() * pm->size().height() / pm->size().width() );
size.setHeight( size.width() * pm.size().height() / pm.size().width() );
}

if ( size.width() != 0 || size.height() != 0 )
Expand Down

0 comments on commit 83749c1

Please sign in to comment.