Quoting Andre Poenitz <[EMAIL PROTECTED]>:

> On Thu, Mar 29, 2007 at 05:36:54PM -0400, Richard Heck wrote:
> > Some discussion with Abdel and my own emerging understanding of what MVC
> > is all about makes it clear that the code needs to be re-organized. The
> > real problem is that there is initialization code in the constructor for
> > PrefColors that is doing two different things: (i) creating the color
> > patches in the dialog and initializing a variable that tracks the
> > current colors. But the constructor is only ever called once, the first
> > time the dialog is created---after that, it exists in memory and is
> > simply recalled when needed---so the existing code never updated the
> > current-colors variable.
>
> You could set WA_DestructiveClose(sp?) which will destroy the dialog on
> close. Than you get a chance to recreate it later...

Good point. We also could have the pref_colors_ module reinitialised on every
show command but then the vector of modules needs to be reconstructed etc...

Richard's fix is good enough for now. One question though, did you check that
your fix survives a LyX restart?

By the way Richard, I saw in mail-archive (gmane is down apparently) that you
were asking about update_contents(). This is part of the QDialogView interface
inherited from the former qt2 frontend. The plan is to get rid of this interface
for all dialogs; this is already done for all DockView base dialogs and also for
the citation dialog. In this new scheme, QCitation derives directly from
ControlCitation and knows nothing about the View (QCitationDialog). In the
former interface, QDialogView was in charge of updating the dialog via
update_contents(). Now the dialog update is done directly by Dialog::update() as
called by the Dialogs class.

The nice thing about this ModelController - View separation is that one can
create a QWidget based dialog without having to understand the GUII framework.
Look at QViewSourceDialog, TocWidget or QCitationDialog for examples on how this
is done.

Abdel.

Reply via email to