Jean-Marc Lasgouttes a écrit :
"Abdel" == Abdel <[EMAIL PROTECTED]> writes:
Let's reply once again to the same message. I think I forgot some
answers.
Abdel> OK, thanks. My main problem is that while a MenuItem is of
Abdel> Submenu kind, sometimes (depends on the document you load and
Abdel> the time of day) its associated submenu is empty. This happens
Abdel> only for the Navigate menu, others works fine.
When you use the navigate menu, the code creates new submenus. It is
thus not possible to give them meaningful names. My question is: why
do you need menus to have names? You can access the submenu itself
using submenu().
Well I _don't_ need the names, it's just that I though the MenuBackend
needed it to expand the submenu. So maybe I got it wrong... Are you
saying that there is no need to expand every submenu? Only one call to
"expand" with the top level nemu name will fill automatically all submenus?
The program flow is supposed to be:
1/ a menu from the menubar is invoked
2/ you get the name of this menu, get the menu from menubackend and
expand it. Now you have a real tree with all the submenus and there is
no need to call getMenu or expandMenu.
This is what I got wrong then. But the qt2 code is very misleading. Each
QLPopupMenu is calling expand:
line 164: owner_->backend().expand(frommenu, tomenu, owner_->view());
Silly me... I see now that there is an "if (toplevel)" condition... I
have wasted many hours on this fxxx problem ;-/
I'll try to fix my code, thanks.
3/ you use this information to create recursively QLPopupMenu:s.
Is that what you do? If it is not, why?
Abdel> Second, I really don't understand why we have to expand the
Abdel> menu we are looking for into a new local menu:
What do you call a new local menu?
Abdel> In my opinion we should just be able to use getMenu() without
Abdel> having to expand it. In this case MenuVackend member menulist_
Abdel> should of course be mutable (because getMenu is a const
Abdel> function). So the MenuBackend should make sure that the menu
Abdel> you ask for is always up to date.
Calling expandMenu _once_ is not so difficult, is it?
Abdel> Another problem that I have is with the MenuItem::func()
Abdel> member. I store it this way in a QLAction which is a lyx
Abdel> tailored QAction: QLAction * action = new
Abdel> QLAction(*(owner_->view()), label, m->func()); So the
Abdel> FuncRequest is stored in the QLAction and is called when you
Abdel> click on the corresponding MenuItem.
Looks reasonable.
Abdel> The problem is that this make lyx crashing for some MenuItem
Abdel> randomly (not all). It seems that this FuncRequest is not
Abdel> constant for a given MenuItem... weird.
I can't tell without more details.
Abdel> I realize now that my explanation is a bit abstract so I attach
Abdel> my ports of QView, QLMenubar and QLPopupmenu to this mail
Abdel> (QLAction is defined in QView.[hC]
I tried to make a diff wrt HEAD, but there are too many changes to
allow me to understand what is important and what is not...
JMarc