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.
This commit is contained in:
Tobias Doerffel
2009-04-05 23:54:28 +02:00
parent 0ae72462d9
commit ff010da5ee
5 changed files with 18 additions and 18 deletions

View File

@@ -575,6 +575,8 @@ void song::updateLength( void )
}
}
m_tracksMutex.unlock();
emit lengthChanged( m_length );
}

View File

@@ -913,7 +913,6 @@ void trackContentWidget::addTCOView( trackContentObjectView * _tcov )
tco->saveJournallingState( false );
changePosition();
tco->restoreJournallingState();
}
@@ -1753,11 +1752,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
}
@@ -1776,6 +1773,7 @@ void track::removeTCO( trackContentObject * _tco )
{
m_trackContentObjects.erase( it );
emit trackContentObjectRemoved( _tco );
engine::getSong()->updateLength();
engine::getSong()->setModified();
}
}

View File

@@ -249,6 +249,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 );
@@ -377,15 +379,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( _we->modifiers() & Qt::ControlModifier )
@@ -428,6 +421,14 @@ void songEditor::wheelEvent( QWheelEvent * _we )
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