Remove unnecessary assignments to pixmaps in TCOs

Simplify the code that reinitializes the pixmap that caches the
graphical representation of some TCO widgets.

See comment in issue #3699.
This commit is contained in:
Michael Gregorius
2017-07-15 15:27:11 +02:00
parent cc3822141e
commit b7b2204cbb
4 changed files with 16 additions and 8 deletions

View File

@@ -241,8 +241,10 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
setNeedsUpdate( false );
m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}
QPainter p( &m_paintPixmap );

View File

@@ -221,8 +221,10 @@ void BBTCOView::paintEvent( QPaintEvent * )
setNeedsUpdate( false );
m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}
QPainter p( &m_paintPixmap );

View File

@@ -870,8 +870,10 @@ void PatternView::paintEvent( QPaintEvent * )
setNeedsUpdate( false );
m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}
QPainter p( &m_paintPixmap );

View File

@@ -459,8 +459,10 @@ void SampleTCOView::paintEvent( QPaintEvent * pe )
setNeedsUpdate( false );
m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}
QPainter p( &m_paintPixmap );