From aeb5d2f1e64976a88603b31ddc918e2775c1f2ae Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 8 Jun 2009 15:36:32 +0000 Subject: [PATCH] add binding information to toolbar button tooltips git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30019 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiToolbar.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 2f9a98953e..7166dd4d58 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -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; } -- 2.39.2