mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
fix AnimatedSplitter and sizing.
this makes AnimatedSplitter set the stretch factor for the desired greedy widget to > 0, so that when QSplitter::resizeEvent is called by non-AnimatedSplitter places, the greedy widget is still respected
This commit is contained in:
@@ -100,7 +100,6 @@ DynamicControlList::init()
|
|||||||
m_collapseLayout->addWidget( m_addControl );
|
m_collapseLayout->addWidget( m_addControl );
|
||||||
m_collapse->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
m_collapse->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||||
|
|
||||||
m_layout->addLayout( m_collapseLayout );
|
|
||||||
// connect( m_collapse, SIGNAL( clicked() ), this, );
|
// connect( m_collapse, SIGNAL( clicked() ), this, );
|
||||||
connect( m_addControl, SIGNAL( clicked() ), this, SLOT( addNewControl() ) );
|
connect( m_addControl, SIGNAL( clicked() ), this, SLOT( addNewControl() ) );
|
||||||
|
|
||||||
@@ -155,18 +154,19 @@ DynamicControlList::onShown( QWidget* w )
|
|||||||
if( w != this )
|
if( w != this )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AnimatedWidget::onShown( w );
|
|
||||||
|
|
||||||
m_layout->removeWidget( m_summaryWidget );
|
m_layout->removeWidget( m_summaryWidget );
|
||||||
m_layout->removeItem( m_collapseLayout );
|
m_layout->removeItem( m_collapseLayout );
|
||||||
|
|
||||||
m_summaryWidget->hide();
|
m_summaryWidget->hide();
|
||||||
foreach( DynamicControlWidget* control, m_controls ) {
|
foreach( DynamicControlWidget* control, m_controls ) {
|
||||||
m_layout->addWidget( control );
|
m_layout->addWidget( control );
|
||||||
control->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_layout->addLayout( m_collapseLayout );
|
m_layout->addLayout( m_collapseLayout );
|
||||||
m_layout->setStretchFactor( m_collapseLayout, 1 );
|
m_layout->setStretchFactor( m_collapseLayout, 1 );
|
||||||
|
|
||||||
|
AnimatedWidget::onShown( w );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicControlList::addNewControl()
|
void DynamicControlList::addNewControl()
|
||||||
|
@@ -195,6 +195,21 @@ AnimatedSplitter::onAnimationFinished()
|
|||||||
m_animateIndex = -1;
|
m_animateIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AnimatedSplitter::setGreedyWidget(int index)
|
||||||
|
{
|
||||||
|
m_greedyIndex = index;
|
||||||
|
if( !widget( index ) )
|
||||||
|
return;
|
||||||
|
QSizePolicy policy = widget( m_greedyIndex )->sizePolicy();
|
||||||
|
if( orientation() == Qt::Horizontal )
|
||||||
|
policy.setHorizontalStretch( 1 );
|
||||||
|
else
|
||||||
|
policy.setVerticalStretch( 1 );
|
||||||
|
widget( m_greedyIndex )->setSizePolicy( policy );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AnimatedSplitter::onHiddenSizeChanged()
|
AnimatedSplitter::onHiddenSizeChanged()
|
||||||
|
@@ -19,7 +19,7 @@ public:
|
|||||||
void show( int index, bool animate = true );
|
void show( int index, bool animate = true );
|
||||||
void hide( int index, bool animate = true );
|
void hide( int index, bool animate = true );
|
||||||
|
|
||||||
void setGreedyWidget( int index ) { m_greedyIndex = index; }
|
void setGreedyWidget( int index );
|
||||||
|
|
||||||
void addWidget( QWidget* widget );
|
void addWidget( QWidget* widget );
|
||||||
void addWidget( AnimatedWidget* widget );
|
void addWidget( AnimatedWidget* widget );
|
||||||
|
Reference in New Issue
Block a user