SongEditor: fixed horizontal scrollbar with Qt 4.5
Due to optimizations in the graphics subsystem of Qt 4.5
songEditor::paintEvent() didn't get called regularly anymore and thus
the range of the horizontal scrollbar didn't get updated at all.
This commit makes the GUI track all changes related to the length of
the song.
(cherry picked from commit ff010da5ee)
This commit is contained in:
@@ -311,6 +311,7 @@ private:
|
||||
friend class controllerRackView;
|
||||
|
||||
signals:
|
||||
void lengthChanged( int _tacts );
|
||||
void tempoChanged( bpm_t _new_bpm );
|
||||
void timeSignatureChanged( int _old_ticks_per_tact,
|
||||
int _ticks_per_tact );
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* song_editor.h - declaration of class songEditor, a window where you can
|
||||
* setup your songs
|
||||
*
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -81,6 +81,7 @@ private slots:
|
||||
void masterPitchMoved( int _new_val );
|
||||
void masterPitchReleased( void );
|
||||
|
||||
void updateScrollBar( int );
|
||||
void updatePosition( const midiTime & _t );
|
||||
|
||||
void zoomingChanged( void );
|
||||
@@ -88,7 +89,6 @@ private slots:
|
||||
|
||||
private:
|
||||
virtual void keyPressEvent( QKeyEvent * _ke );
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
virtual void wheelEvent( QWheelEvent * _we );
|
||||
|
||||
virtual bool allowRubberband( void ) const;
|
||||
|
||||
@@ -575,6 +575,8 @@ void song::updateLength( void )
|
||||
}
|
||||
}
|
||||
m_tracksMutex.unlock();
|
||||
|
||||
emit lengthChanged( m_length );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -913,7 +913,6 @@ void trackContentWidget::addTCOView( trackContentObjectView * _tcov )
|
||||
tco->saveJournallingState( false );
|
||||
changePosition();
|
||||
tco->restoreJournallingState();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1776,11 +1775,9 @@ trackContentObject * track::addTCO( trackContentObject * _tco )
|
||||
{
|
||||
m_trackContentObjects.push_back( _tco );
|
||||
|
||||
// emit dataChanged();
|
||||
emit trackContentObjectAdded( _tco );
|
||||
|
||||
//engine::getSongEditor()->setModified();
|
||||
return( _tco ); // just for convenience
|
||||
return _tco; // just for convenience
|
||||
}
|
||||
|
||||
|
||||
@@ -1798,6 +1795,7 @@ void track::removeTCO( trackContentObject * _tco )
|
||||
if( it != m_trackContentObjects.end() )
|
||||
{
|
||||
m_trackContentObjects.erase( it );
|
||||
engine::getSong()->updateLength();
|
||||
engine::getSong()->setModified();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,6 +374,8 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
static_cast<QVBoxLayout *>( layout() )->addWidget( m_leftRightScroll );
|
||||
connect( m_leftRightScroll, SIGNAL( valueChanged( int ) ),
|
||||
this, SLOT( scrolled( int ) ) );
|
||||
connect( m_s, SIGNAL( lengthChanged( int ) ),
|
||||
this, SLOT( updateScrollBar( int ) ) );
|
||||
|
||||
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
@@ -509,15 +511,6 @@ void songEditor::keyPressEvent( QKeyEvent * _ke )
|
||||
|
||||
|
||||
|
||||
void songEditor::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
m_leftRightScroll->setMaximum( m_s->length() );
|
||||
trackContainerView::paintEvent( _pe );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void songEditor::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
|
||||
@@ -646,6 +639,14 @@ void songEditor::masterPitchReleased( void )
|
||||
|
||||
|
||||
|
||||
void songEditor::updateScrollBar( int _len )
|
||||
{
|
||||
m_leftRightScroll->setMaximum( _len );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void songEditor::updatePosition( const midiTime & _t )
|
||||
{
|
||||
if( ( m_s->isPlaying() && m_s->m_playMode == song::Mode_PlaySong
|
||||
|
||||
Reference in New Issue
Block a user