On Wednesday, April 3, 2024 at 4:54:32 AM UTC-5 Edward K. Ream wrote:

It took me a while to understand what the @button node is doing.
...
I'm satisfied neither with #407 
<https://github.com/leo-editor/leo-editor/issues/407> nor with the script. 
I would prefer some ways of splitting the icon bar at specific places. I 
have just created #3851 
<https://github.com/leo-editor/leo-editor/issues/3851>.


Alright, I think I understand the bounds of the problem.


Googling shows that the QToolbar class has inherent limitations. There is *no 
way* to split QToolButton widgets into separate rows. Happily, the toolbar 
shows an *extension icon* on the far right when there are too many buttons. 
Clicking this icon will show the remaining widgets on separate lines. The 
newly revealed icons *remain visible* until the user clicks the extension 
icon again.


I never noticed this behavior before. Worse, my dark theme obscured the 
extension icon! I've corrected that bug by giving the icon a lighter 
background color.


*@button expand-toolbar*


This script needs more explanation. The script creates a button that 
duplicates the purpose of the extension icon. The script (@button node) 
does nothing if everything in the icon bar is already visible.


The script simulates a *single* keypress (and release) on the extension 
icon. Therefore, the newly revealed icons will *remain visible* until the 
user presses the button (or the actual extension icon).


The test:  if w.objectName() == 'qt_toolbar_ext_button':


looks for the name that Qt assigns to the expansion icon. This name *has 
nothing to do with the headline of the @button node!*


*Summary*


At long last, I understand the inherent limitations of the QToolbar widget. 
There seems to be no way to split its contents into separate (always 
visible) lines.


Otoh, the extension icon shows all widgets when clicked and *continues to 
do so* until clicked again. This behavior is good enough for most purposes.


I've corrected my dark theme to show the extension icon. The icon must not 
have a black background.


The given @button script works, but it needs some explanation. I'll amend 
#3851 <https://github.com/leo-editor/leo-editor/issues/3851> accordingly.


Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/3ed6961a-4ced-4b55-9126-9762a8b9f2edn%40googlegroups.com.

Reply via email to