shortcuts.cpp
changeset 806 2a33304714ba
child 824 36eb4b8f409e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/shortcuts.cpp	Tue Nov 17 08:24:59 2009 +0000
     1.3 @@ -0,0 +1,36 @@
     1.4 +#include "shortcuts.h"
     1.5 +
     1.6 +#include <iostream>
     1.7 +using namespace std;
     1.8 +
     1.9 +/////////////////////////////////////////////////////////////////
    1.10 +// Shortcut
    1.11 +/////////////////////////////////////////////////////////////////
    1.12 +Shortcut::Shortcut(QWidget *parent) :QShortcut (parent)
    1.13 +{
    1.14 +}
    1.15 +
    1.16 +/////////////////////////////////////////////////////////////////
    1.17 +// Switchboard
    1.18 +/////////////////////////////////////////////////////////////////
    1.19 +Switchboard::Switchboard ()
    1.20 +{
    1.21 +}
    1.22 +
    1.23 +void Switchboard::addConnection (QAction *a, const QString &desc)
    1.24 +{	
    1.25 +	QKeySequence ks=QKeySequence::fromString (desc);
    1.26 +	actions.append (a);
    1.27 +	if (!desc.isEmpty()) keys.append (new QKeySequence (ks));
    1.28 +	if (a) a->setShortcut (ks);
    1.29 +}
    1.30 +
    1.31 +void Switchboard::print ()
    1.32 +{
    1.33 +	for (int i=0;i<actions.size();++i)
    1.34 +	{
    1.35 +		cout <<actions.at(i)->shortcut().toString().toStdString();
    1.36 +		cout << "  Action: " <<actions.at(i)->text().toStdString();
    1.37 +		cout <<endl;
    1.38 +	}
    1.39 +}