InstrumentTrackView: save and restore last position of window

When closing a InstrumentTrackWindow save its position so it can be
restored later when showing it. Fixes windows always popping up
somewhere else when toggling instrument track button repeatedly.
This commit is contained in:
Tobias Doerffel
2009-04-18 18:25:44 +02:00
parent 75382de976
commit 232c1de404
2 changed files with 11 additions and 2 deletions

View File

@@ -861,7 +861,8 @@ QQueue<instrumentTrackWindow *> instrumentTrackView::s_windows;
instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
trackContainerView * _tcv ) :
trackView( _it, _tcv ),
m_window( NULL )
m_window( NULL ),
m_lastPos( -1, -1 )
{
setAcceptDrops( true );
setFixedHeight( 32 );
@@ -971,6 +972,7 @@ void instrumentTrackView::freeInstrumentTrackWindow( void )
{
if( m_window != NULL )
{
m_lastPos = m_window->parentWidget()->pos();
if( s_windows.count() < INSTRUMENT_WINDOW_CACHE_SIZE )
{
model()->setHook( NULL );
@@ -1017,6 +1019,11 @@ instrumentTrackWindow * instrumentTrackView::getInstrumentTrackWindow( void )
m_window->setModel( model() );
m_window->updateInstrumentView();
model()->setHook( m_window );
if( m_lastPos.x() > 0 || m_lastPos.y() > 0 )
{
m_window->parentWidget()->move( m_lastPos );
}
}
else
{