comparison widgets/KeyReference.cpp @ 743:a352fb986e7b tony_integration

Merge from branch tonioni
author Chris Cannam
date Tue, 11 Mar 2014 17:33:19 +0000
parents a31c8ee2e17e
children 394caa98d21a
comparison
equal deleted inserted replaced
718:e5f4385615ac 743:a352fb986e7b
47 KeyReference::registerShortcut(QAction *action, QString overrideName) 47 KeyReference::registerShortcut(QAction *action, QString overrideName)
48 { 48 {
49 QString name = action->text(); 49 QString name = action->text();
50 if (overrideName != "") name = overrideName; 50 if (overrideName != "") name = overrideName;
51 51
52 QString shortcut = action->shortcut().toString(); 52 QString shortcut = action->shortcut().toString(QKeySequence::NativeText);
53 QString tip = action->statusTip(); 53 QString tip = action->statusTip();
54 54
55 registerShortcut(name, shortcut, tip); 55 registerShortcut(name, shortcut, tip);
56 } 56 }
57 57
85 QString name = action->text(); 85 QString name = action->text();
86 registerAlternativeShortcut(name, alternative); 86 registerAlternativeShortcut(name, alternative);
87 } 87 }
88 88
89 void 89 void
90 KeyReference::registerAlternativeShortcut(QAction *action, QKeySequence shortcut)
91 {
92 QString name = action->text();
93 registerAlternativeShortcut(name, shortcut.toString(QKeySequence::NativeText));
94 }
95
96 void
90 KeyReference::registerAlternativeShortcut(QString name, QString alternative) 97 KeyReference::registerAlternativeShortcut(QString name, QString alternative)
91 { 98 {
92 name.replace(tr("&"), ""); 99 name.replace(tr("&"), "");
93 100
94 KeyList &list = m_map[m_currentCategory]; 101 KeyList &list = m_map[m_currentCategory];
97 if (i->actionName == name) { 104 if (i->actionName == name) {
98 i->alternatives.push_back(alternative); 105 i->alternatives.push_back(alternative);
99 return; 106 return;
100 } 107 }
101 } 108 }
109 }
110
111 void
112 KeyReference::registerAlternativeShortcut(QString name, QKeySequence shortcut)
113 {
114 registerAlternativeShortcut(name, shortcut.toString(QKeySequence::NativeText));
102 } 115 }
103 116
104 void 117 void
105 KeyReference::show() 118 KeyReference::show()
106 { 119 {
145 altdesc += tr("<i>or</i>&nbsp;<b>%1</b>").arg(alt); 158 altdesc += tr("<i>or</i>&nbsp;<b>%1</b>").arg(alt);
146 } 159 }
147 altdesc = tr("</b>&nbsp;(%1)<b>").arg(altdesc); 160 altdesc = tr("</b>&nbsp;(%1)<b>").arg(altdesc);
148 } 161 }
149 162
150 text += QString("<tr><td>&nbsp;<b>%1%2</b></td><td>&nbsp;%3</td><td>%4</td></tr>\n") 163 text += QString("<tr><td width=\"12%\">&nbsp;<b>%1%2</b></td><td>&nbsp;%3</td><td>%4</td></tr>\n")
151 .arg(shortcut).arg(altdesc).arg(actionName).arg(tip); 164 .arg(shortcut).arg(altdesc).arg(actionName).arg(tip);
152 } 165 }
153 } 166 }
154 167
155 text += "</table></center>\n"; 168 text += "</table></center>\n";