shortcuts.cpp
author insilmaril
Wed, 25 Nov 2009 10:58:21 +0000
changeset 807 f9f7922989d8
parent 806 2a33304714ba
child 824 36eb4b8f409e
permissions -rw-r--r--
Added demos/vym-contribute.vym, fixes for selecting items
     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 }