add binding information to toolbar button tooltips

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30019 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-06-08 15:36:32 +00:00
parent 869cdfd487
commit aeb5d2f1e6

View File

@ -32,6 +32,7 @@
#include "Cursor.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "KeyMap.h"
#include "Layout.h"
#include "LyXFunc.h"
#include "LyXRC.h"
@ -730,8 +731,15 @@ void GuiToolbar::setVisibility(int visibility)
Action * GuiToolbar::addItem(ToolbarItem const & item)
{
QString text = toqstr(item.label_);
// Get the keys bound to this action, but keep only the
// first one later
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(item.func_);
if (bindings.size())
text += " [" + toqstr(bindings.begin()->print(KeySequence::ForGui)) + "]";
Action * act = new Action(&owner_, getIcon(item.func_, false),
toqstr(item.label_), item.func_, toqstr(item.label_), this);
text, item.func_, text, this);
actions_.append(act);
return act;
}