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.
(cherry picked from commit 232c1de404)
This commit is contained in:
@@ -288,7 +288,7 @@ private slots:
|
||||
|
||||
private:
|
||||
instrumentTrackWindow * m_window;
|
||||
|
||||
|
||||
static QQueue<instrumentTrackWindow *> s_windows;
|
||||
|
||||
// widgets in track-settings-widget
|
||||
@@ -302,6 +302,8 @@ private:
|
||||
QAction * m_midiInputAction;
|
||||
QAction * m_midiOutputAction;
|
||||
|
||||
QPoint m_lastPos;
|
||||
|
||||
|
||||
friend class instrumentTrackWindow;
|
||||
|
||||
|
||||
@@ -860,7 +860,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 );
|
||||
@@ -970,6 +971,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 );
|
||||
@@ -1016,6 +1018,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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user