Menu

[2edc72]: / shortcuts.cpp  Maximize  Restore  History

Download this file

72 lines (63 with data), 1.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <QDebug>
#include <QMultiMap>
#include <iostream>
using namespace std;
#include "shortcuts.h"
/////////////////////////////////////////////////////////////////
// Shortcut
/////////////////////////////////////////////////////////////////
Shortcut::Shortcut(QWidget *parent) :QShortcut (parent)
{
}
/////////////////////////////////////////////////////////////////
// Switchboard
/////////////////////////////////////////////////////////////////
Switchboard::Switchboard ()
{
}
void Switchboard::addConnection (QAction *a, const QString &group) //FIXME-4 obsolete
{
actions.insert(group,a);
}
void Switchboard::addConnection (QWidget *w, QAction *a, const QString &group)
{
actions.insert(group,a);
if (w) w->addAction (a);
}
void Switchboard::print ()
{
QString g;
foreach (g,actions.uniqueKeys())
{
cout << qPrintable(g)<<endl;
QList <QAction*> values=actions.values(g);
for (int i=0;i<values.size();++i)
{
QString desc=values.at(i)->text();
QString sc=values.at(i)->shortcut().toString();
desc=desc.remove('&');
desc=desc.remove("...");
printf (" %10s: %s\n",qPrintable(sc),qPrintable(desc));
}
cout <<endl;
}
}
void Switchboard::printLaTeX ()
{
QString g;
foreach (g,actions.uniqueKeys())
{
cout <<"Group: "<<qPrintable(g)<<"\\\\ \\hline"<<endl;
QList <QAction*> values=actions.values(g);
for (int i=0;i<values.size();++i)
if (!values.at(i)->shortcut().toString().isEmpty())
{
QString desc=values.at(i)->text();
QString sc=values.at(i)->shortcut().toString();
desc=desc.remove('&');
desc=desc.remove("...");
printf (" %10s & %s\\\\ \n",qPrintable(sc),qPrintable(desc));
}
cout <<endl;
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.