Skip to content
Permalink
Browse files
Limit heght of PixmapLabel to 20 pixels (#46069)
Becoming smaller bring the pixmap to flickering
in some situations when resizing the attribute form

Co-authored-by: Damiano Lombardi <damiano@opengis.ch>
  • Loading branch information
qgis-bot and domi4484 committed Nov 16, 2021
1 parent 1a5f304 commit c82edcd62649a5b4b89b3fa762c6c3a5519f450c
Showing with 8 additions and 1 deletion.
  1. +6 −1 src/gui/qgspixmaplabel.cpp
  2. +2 −0 src/gui/qgspixmaplabel.h
@@ -19,14 +19,18 @@
QgsPixmapLabel::QgsPixmapLabel( QWidget *parent )
: QLabel( parent )
{
this->setMinimumSize( 1, 1 );
}

void QgsPixmapLabel::setPixmap( const QPixmap &p )
{
const bool sizeChanged = ( p.size() != mPixmap.size() );
mPixmap = p;

if ( mPixmap.isNull() )
this->setMinimumHeight( 0 );
else
this->setMinimumHeight( PIXMAP_MINIMUM_HEIGHT );

if ( sizeChanged )
{
updateGeometry();
@@ -66,4 +70,5 @@ void QgsPixmapLabel::clear()
{
mPixmap = QPixmap();
QLabel::clear();
this->setMinimumHeight( 0 );
}
@@ -59,6 +59,8 @@ class GUI_EXPORT QgsPixmapLabel : public QLabel

private:

static const int PIXMAP_MINIMUM_HEIGHT = 20;

QPixmap mPixmap;
};

0 comments on commit c82edcd

Please sign in to comment.