Skip to content
Permalink
Browse files
Limit heght of PixmapLabel to 20 pixels
Becoming smaller bring the pixmap to flickering
in some situations when resizing the attribute form
  • Loading branch information
domi4484 authored and github-actions committed Nov 16, 2021
1 parent 1659096 commit 33b1b96b05e1f5998f9707749979701939b79e2a
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 33b1b96

Please sign in to comment.