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(a)gmx.net, kretz(a)kde.org,
Matthias.Kretz(a)urz.uni-heidelberg.de