also connect model-signals with view when using default-constructed model - fixes missing updates on things like button-groups when using automation
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@775 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mv_base.cpp - base for M/V-architecture of LMMS
|
||||
*
|
||||
* Copyright (c) 2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -30,12 +30,19 @@
|
||||
#include "mv_base.h"
|
||||
|
||||
|
||||
modelView::modelView( model * _model ) :
|
||||
m_model( _model )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void modelView::setModel( model * _model, bool _old_model_valid )
|
||||
{
|
||||
QWidget * w = dynamic_cast<QWidget *>( this );
|
||||
assert( w != NULL );
|
||||
|
||||
//printf("w: %x m_model:%x _model:%x\n", w, m_model, _model);
|
||||
if( _old_model_valid && m_model != NULL )
|
||||
{
|
||||
if( m_model->defaultConstructed() )
|
||||
@@ -48,10 +55,8 @@ void modelView::setModel( model * _model, bool _old_model_valid )
|
||||
}
|
||||
}
|
||||
m_model = _model;
|
||||
QObject::connect( _model, SIGNAL( dataChanged() ),
|
||||
w, SLOT( update() ), Qt::QueuedConnection );
|
||||
QObject::connect( _model, SIGNAL( propertiesChanged() ),
|
||||
w, SLOT( update() ), Qt::QueuedConnection );
|
||||
|
||||
doConnections();
|
||||
|
||||
w->update();
|
||||
|
||||
@@ -60,5 +65,21 @@ void modelView::setModel( model * _model, bool _old_model_valid )
|
||||
|
||||
|
||||
|
||||
|
||||
void modelView::doConnections( void )
|
||||
{
|
||||
if( m_model != NULL )
|
||||
{
|
||||
QWidget * w = dynamic_cast<QWidget *>( this );
|
||||
QObject::connect( m_model, SIGNAL( dataChanged() ),
|
||||
w, SLOT( update() ), Qt::QueuedConnection );
|
||||
QObject::connect( m_model, SIGNAL( propertiesChanged() ),
|
||||
w, SLOT( update() ), Qt::QueuedConnection );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "mv_base.moc"
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ automatableButton::automatableButton( QWidget * _parent,
|
||||
m_group( NULL )
|
||||
{
|
||||
setAccessibleName( _name );
|
||||
doConnections();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ comboBox::comboBox( QWidget * _parent, const QString & _name ) :
|
||||
this, SLOT( setItem( QAction * ) ) );
|
||||
|
||||
setAccessibleName( _name );
|
||||
doConnections();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) :
|
||||
|
||||
setFixedSize( m_knobPixmap->width(), m_knobPixmap->height() );
|
||||
setTotalAngle( 270.0f );
|
||||
doConnections();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user