using uimenu objects to provide Qt figure window menus

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

using uimenu objects to provide Qt figure window menus

John W. Eaton
Administrator
Some time ago when I asked about deprecating the fltk plotting widget,
one of the reasons given to delay doing that was that the qt widget does
not use uimenu objects for the figure menus.  I'd like to fix that but
would like to have some input from others first.

I see that if I comment out the lines

   ## Only FLTK toolkit currently provides menubar
   if (! strcmp (get (fig, "__graphics_toolkit__"), "fltk"))
     return;
   endif

in scripts/plot/util/private/__add_default_menu__.m, then additional
"file" and "edit" menus are added to the figure menubar.  These are the
same as the ones use for the fltk figure window and the actions appear
to work.  So I think the comment about only the fltk toolkit providing a
menubar is not correct.  Then it seems that the simplest fix would be to
eliminate the built-in menus from the qt widget and enable these menu
items instead.  But then we would lose the "help" menu from the qt
widget, and the items in the "edit" menu are not the same in the qt and
fltk widgets, and the qt "edit" menu has icons that are not present in
the fltk widget.

It would be easy enough to add a help menu for both the qt and fltk
plotting widgets.

What should we do about the items in the "edit" menu?  I guess it makes
sense to merge all items so the the qt and fltk widgets have the same set.

What about icons in the uimenu items?  There seems to be no standard
Matlab way to do that.  Should we add a new "__icon__" property?  Or
just use the "userdata" property for the icon name?

jwe

Reply | Threaded
Open this post in threaded view
|

Re: using uimenu objects to provide Qt figure window menus

Pantxo
I have a preliminary patch I wrote a few month ago that does the switch
to uimenu for qt. You may want to use it.

Pantxo


qt_use_uimenus.patch (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: using uimenu objects to provide Qt figure window menus

John W. Eaton
Administrator
On 09/12/2018 04:40 PM, Pantxo Diribarne wrote:
> I have a preliminary patch I wrote a few month ago that does the switch
> to uimenu for qt. You may want to use it.

Thanks.  Do you want to go ahead and commit this change?  Or is it
incomplete?

jwe


Reply | Threaded
Open this post in threaded view
|

Re: using uimenu objects to provide Qt figure window menus

Pantxo
Le 12/09/2018 à 22:51, John W. Eaton a écrit :
> On 09/12/2018 04:40 PM, Pantxo Diribarne wrote:
>> I have a preliminary patch I wrote a few month ago that does the
>> switch to uimenu for qt. You may want to use it.
>
> Thanks.  Do you want to go ahead and commit this change?  Or is it
> incomplete?
>
> jwe
>
Forgot to cc the maintainers list.


Yes I can commit it tomorrow, once I have taken a closer look.
About menu icons, I wouldn't bother adding this feature. At least we
currently cannot handle transparent images from the interpreter and this
leads to ugly backgrounds that don't really look serious. That is
something I noticed while writing another patch (that needs much more
work) for using a uitoolbar also for the default toolbar.

Pantxo


Reply | Threaded
Open this post in threaded view
|

Re: using uimenu objects to provide Qt figure window menus

Pantxo
Reply | Threaded
Open this post in threaded view
|

Re: using uimenu objects to provide Qt figure window menus

Pantxo
In reply to this post by Pantxo
FTR I attached an image where I put the first default menus of a Matlab figure. Note the Matlab was running on the linux server of my lab
ml_menus.png
and the shortcuts are then emcs like.

Pantxo

Le mer. 12 sept. 2018 à 23:34, Pantxo Diribarne <[hidden email]> a écrit :
Le 12/09/2018 à 22:51, John W. Eaton a écrit :
> On 09/12/2018 04:40 PM, Pantxo Diribarne wrote:
>> I have a preliminary patch I wrote a few month ago that does the
>> switch to uimenu for qt. You may want to use it.
>
> Thanks.  Do you want to go ahead and commit this change?  Or is it
> incomplete?
>
> jwe
>
Forgot to cc the maintainers list.


Yes I can commit it tomorrow, once I have taken a closer look.
About menu icons, I wouldn't bother adding this feature. At least we
currently cannot handle transparent images from the interpreter and this
leads to ugly backgrounds that don't really look serious. That is
something I noticed while writing another patch (that needs much more
work) for using a uitoolbar also for the default toolbar.

Pantxo