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