Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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[bot] committed Nov 16, 2021
1 parent 1659096 commit 33b1b96
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 33b1b96

Please sign in to comment.