Angus Leeming a écrit :
Jean-Marc Lasgouttes wrote:
While this is not a good example, I do think that unification of
menubar and toolbar would be useful. But of course, I would do it
in the existing backend framework...
Andre> 'QAction'...
What' so great about QAction? Just that the whole qt GUI uses it?
Is it more than a struct?
It appears that André has been converted to the Qt mind set ;-)
QAction is indeed a nice abstraction:
QAction* openAction =
new QAction(SmallIcon("fileopen.png"), i18n("&Open..."), this);
openAction->setShortcut(i18n("Ctrl+O"));
connect(openAction, SIGNAL(activated()), view, SLOT(slotFileOpen()));
QMenuBar* menubar = menuBar();
QMenu* file_menu = new QMenu(i18n("&File"), menubar);
menubar->addMenu(file_menu);
QToolBar* toolbar = toolBar();
file_menu->addAction(openAction);
toolbar->addAction(openAction);
but we can certainly use this abstraction without limiting ourselves to a
particular toolkit. In fact, I think that Abdel was proposing some
post-1.4 code that does exactly this.
Your suggested "unification of menubar and toolbar" amounts essentially to
defining these "LyXAction"s.
Hey, wait! Isn't that essentially what we have already?
Indeed, I've just had a look at LyxAction. Basically this could be
extended to be the Lyx action back-end I was talking about. But please
rename that to LyxActionBackend ;-).
Side note: Is there a reason why lyxaction is a global variable? (I
_don't_ like global variable). Well, I have noticed that this is not the
only case of a global variable in the source code. IMHO, we should get
rid of all these and put them in a core class, call it lyx_core, that
would manage all these global data.
Abdel.
;-)