Disable stuff automatically in dialogs with read-only

Richard Kimberly Heck rikiheck at lyx.org
Tue Dec 1 15:46:29 UTC 2020


On 12/1/20 9:50 AM, Jean-Marc Lasgouttes wrote:
> Dear all,
>
> ButtonController has a addReadonly() feature that allows to control
> which widgets should be disabled in read-only mode. It add the widgets
> to a read_only_ vector<widget>, but this vector is never used? Why?
>
> The answer is that the code was disabled a long time ago, and (partly)
> removed.
>
> commit 78ade7e6ec18b8f34645f5629500a79e103dda72
> Author: Richard Kimberly Heck <rikiheck at lyx.org>
> Date:   Fri Feb 28 00:08:30 2020 -0500
>
>     Remove code that has not been used for 13 years.
>
>
>
> The better answer, though, is that the disabling clashed with
> hand-made disabling and got disabled rather than fixed.
>
> Author: Uwe Stöhr <uwestoehr at web.de>
> Date:   Thu Sep 27 21:03:26 2007 +0000
>
>     ButtonController.cpp: fix a bug introduced in r20018: don't enable
> all widgets in the dialog, see
> http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg128222.html
>
> The archive above explains that this enabling/disabling clashes with
> explicit disabling like in the Box dialog.
>
> So the very unsatisfying situation is that we have code in dialogs
> which annotates which widgets should be disabled in read-only mode,
> but these calls do nothing.
>
> Any bright idea on how to fix this?
>
> I see two approaches:
>
> 1/ add a ButtonController::setDisabled(widget, bool) and use that
> everywhere instead of explicit calls to QWidget::setEnabled
>
> 2/ consider that ButtonController is already ugly enough and replace
> all addReadOnly calls with proper hand-made setEnabled calls on the
> relevant widgets.
>
> Any idea from people who know more than I do about dialogs?

Jürgen knows the most about this, I think, but my sense is that (2) is
the way to go. I find the ButtonController quite difficult to use.

Riki




More information about the lyx-devel mailing list