shortcuts.cpp
author insilmaril
Fri, 19 Feb 2010 13:47:03 +0000
changeset 823 0bba81dde1bc
parent 806 2a33304714ba
child 824 36eb4b8f409e
permissions -rw-r--r--
More fixes
     1 #include "shortcuts.h"
     2 
     3 #include <iostream>
     4 using namespace std;
     5 
     6 /////////////////////////////////////////////////////////////////
     7 // Shortcut
     8 /////////////////////////////////////////////////////////////////
     9 Shortcut::Shortcut(QWidget *parent) :QShortcut (parent)
    10 {
    11 }
    12 
    13 /////////////////////////////////////////////////////////////////
    14 // Switchboard
    15 /////////////////////////////////////////////////////////////////
    16 Switchboard::Switchboard ()
    17 {
    18 }
    19 
    20 void Switchboard::addConnection (QAction *a, const QString &desc)
    21 {	
    22 	QKeySequence ks=QKeySequence::fromString (desc);
    23 	actions.append (a);
    24 	if (!desc.isEmpty()) keys.append (new QKeySequence (ks));
    25 	if (a) a->setShortcut (ks);
    26 }
    27 
    28 void Switchboard::print ()
    29 {
    30 	for (int i=0;i<actions.size();++i)
    31 	{
    32 		cout <<actions.at(i)->shortcut().toString().toStdString();
    33 		cout << "  Action: " <<actions.at(i)->text().toStdString();
    34 		cout <<endl;
    35 	}
    36 }