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:
Tobias Doerffel
2008-03-08 08:25:24 +00:00
parent f03d122732
commit a3813eff2b
6 changed files with 44 additions and 11 deletions

View File

@@ -1,3 +1,14 @@
2008-03-08 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/mv_base.h:
* src/widgets/combobox.cpp:
* src/widgets/knob.cpp:
* src/widgets/automatable_button.cpp:
* src/core/mv_base.cpp:
also connect model-signals with view when using default-constructed
model - fixes missing updates on things like button-groups when using
automation
2008-03-07 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/vst_base/lvsl_server.cpp:

View File

@@ -72,11 +72,7 @@ signals:
class modelView
{
public:
modelView( model * _model ) :
m_model( _model )
{
}
modelView( model * _model );
virtual ~modelView()
{
}
@@ -102,6 +98,8 @@ protected:
{
}
void doConnections( void );
private:
model * m_model;

View File

@@ -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"

View File

@@ -46,6 +46,7 @@ automatableButton::automatableButton( QWidget * _parent,
m_group( NULL )
{
setAccessibleName( _name );
doConnections();
}

View File

@@ -80,6 +80,7 @@ comboBox::comboBox( QWidget * _parent, const QString & _name ) :
this, SLOT( setItem( QAction * ) ) );
setAccessibleName( _name );
doConnections();
}

View File

@@ -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();
}