Skip to content
Merged
Next Next commit
WIP; sped up expansion of plugin descriptor widgets in the sidebar.
  • Loading branch information
irrenhaus3 committed Aug 18, 2017
commit 4d2274fd61f3f9e0ef9d666c168e31630e416e5f
3 changes: 3 additions & 0 deletions include/PluginBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ private slots:


private:
constexpr static int DEFAULT_HEIGHT{24};
constexpr static int HEIGHT_INCREMENT{4};

QTimer m_updateTimer;

const Plugin::Descriptor & m_pluginDescriptor;
Expand Down
12 changes: 6 additions & 6 deletions src/gui/PluginBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ PluginDescWidget::PluginDescWidget( const Plugin::Descriptor & _pd,
m_pluginDescriptor( _pd ),
m_logo( _pd.logo->pixmap() ),
m_mouseOver( false ),
m_targetHeight( 24 )
m_targetHeight( DEFAULT_HEIGHT )
{
connect( &m_updateTimer, SIGNAL( timeout() ), SLOT( updateHeight() ) );
setFixedHeight( m_targetHeight );
Expand Down Expand Up @@ -160,7 +160,7 @@ void PluginDescWidget::paintEvent( QPaintEvent * e )
p.drawText( 10 + logo_size.width(), 15,
m_pluginDescriptor.displayName );

if( height() > 24 || m_mouseOver )
if( height() > DEFAULT_HEIGHT || m_mouseOver )
{
f.setBold( false );
p.setFont( f );
Expand All @@ -182,7 +182,7 @@ void PluginDescWidget::paintEvent( QPaintEvent * e )
void PluginDescWidget::enterEvent( QEvent * _e )
{
m_mouseOver = true;
m_targetHeight = height() + 1;
m_targetHeight = height() + HEIGHT_INCREMENT;
updateHeight();
QWidget::enterEvent( _e );
}
Expand All @@ -193,7 +193,7 @@ void PluginDescWidget::enterEvent( QEvent * _e )
void PluginDescWidget::leaveEvent( QEvent * _e )
{
m_mouseOver = false;
m_targetHeight = 24;
m_targetHeight = DEFAULT_HEIGHT;
updateHeight();
QWidget::leaveEvent( _e );
}
Expand All @@ -218,11 +218,11 @@ void PluginDescWidget::updateHeight()
{
if( m_targetHeight > height() )
{
setFixedHeight( height() + 1 );
setFixedHeight( height() + HEIGHT_INCREMENT );
}
else if( m_targetHeight < height() )
{
setFixedHeight( height() - 1 );
setFixedHeight( height() - HEIGHT_INCREMENT );
}
else
{
Expand Down