Skip to content

Commit

Permalink
Limit heght of PixmapLabel to 20 pixels
Browse files Browse the repository at this point in the history
Becoming smaller bring the pixmap to flickering
in some situations when resizing the attribute form
  • Loading branch information
domi4484 authored and nyalldawson committed Nov 15, 2021
1 parent 8ceff0e commit bfab3f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/qgspixmaplabel.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -66,4 +70,5 @@ void QgsPixmapLabel::clear()
{
mPixmap = QPixmap();
QLabel::clear();
this->setMinimumHeight( 0 );
}
2 changes: 2 additions & 0 deletions src/gui/qgspixmaplabel.h
Expand Up @@ -59,6 +59,8 @@ class GUI_EXPORT QgsPixmapLabel : public QLabel

private:

static const int PIXMAP_MINIMUM_HEIGHT = 20;

QPixmap mPixmap;
};

Expand Down

0 comments on commit bfab3f7

Please sign in to comment.