[linux-audio-dev] Re: MVC

Matthias Kretz Matthias.Kretz at urz.uni-heidelberg.de
Sat May 10 18:32:01 UTC 2003


On Saturday May 10 2003 23:17, Paul Davis wrote:
> thats not really the question at all. the question is: can i set the
> button ("view") to show some state in the model without it appearing
> that the user pressed the button?

Ok, good. I wrote that, though...

> >class Model
> >{
> >  public:
> >    Model();
> >  private slots:
> >    void viewChanged( int value );
> >  private:
> >    View *_view1, *_view2;
> >}
>
> instant violation of the core of MVC. Models don't know about
> Views. 

In what sense? They have to know the interface. You mean they don't have a 
pointer to the views?

> that's why MVC is so powerful: you can create multiple views 
> (and multiple controls) for the same model without changing anything
> about the model's implementation. it has no clue how its state is
> being presented, and doesn't care. likewise, it doesn't care how many
> different sources there are of state changes. they could come from the
> keyboard, the mouse, a USB device, a MIDI device, a radio interface,
> an ethernet interface etc. etc. each one is independent of all others
> (and often is independent of the views too).

Allright. I just wanted to give a short example of how to do the 
"can i set the button ("view") to show some state in the model without it 
appearing that the user pressed the button?" with Qt. I didn't want to write 
a full MVC example.

-- 
C'ya
        Matthias
________________________________________________________
Matthias Kretz (Germany)                          <><
http://Vir.homeip.net/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20030510/b15937f8/attachment.pgp>


More information about the Linux-audio-dev mailing list