edbee - Qt Editor Library
Public Member Functions | Static Public Member Functions | List of all members
edbee::TextEditorKeyMap Class Reference

A text editor key map This key map, maps key-sequences to action-names. More...

#include <texteditorkeymap.h>

+ Collaboration diagram for edbee::TextEditorKeyMap:

Public Member Functions

 TextEditorKeyMap (TextEditorKeyMap *parentKeyMap=0)
 
virtual ~TextEditorKeyMap ()
 the copy constructor More...
 
void copyKeysTo (TextEditorKeyMap *keyMap)
 copies the given keys to the other keymap More...
 
TextEditorKeyget (const QString &name) const
 Returns the last inserted keysequence for the given command It also tries to search the parent keymap if it's available. More...
 
QKeySequence getSequence (const QString &name) const
 Returns the key sequence for the given name. More...
 
QList< TextEditorKey * > getAll (const QString &name) const
 Returns al list of all keysequences for the given command This method will also search the parents for the given keysequences. More...
 
bool has (const QString &name) const
 Tests if the keymap has the given action It will also search the parent key map. More...
 
void add (const QString &command, TextEditorKey *sequence)
 Adds the given key sequence to the keymap. More...
 
void add (const QString &command, const QKeySequence &seq)
 Adds the given key sequence to the keymap. More...
 
bool add (const QString &command, const QString &seq)
 Adds a command - key sequence with a string If first tries to match the string with the standardkey-texts If this doesn't result in a sequence it assumes it's a keydefinition used by QKeySequence. More...
 
void replace (const QString &name, TextEditorKey *sequence)
 replace the given command with the given key sequence all other keysequences (on this level) are ignored More...
 
QString findBySequence (QKeySequence sequence, QKeySequence::SequenceMatch &match)
 Searches for the given command with a keysequence Warning when one keysequence is the prefix of the other keysequence it is possible only the partial or full match is return (depending on the order) More...
 
QString toString () const
 returns all added actions More...
 
TextEditorKeyMapparentMap ()
 

Static Public Member Functions

static QKeySequence joinKeySequences (const QKeySequence seq1, const QKeySequence seq2)
 This method joins 2 key-sequences to 1 sequence (if possible) if seq1 + se2 length > 4 seq2 is returned. More...
 
static QKeySequence::StandardKey standardKeyFromString (const QString &str)
 converts a string to a standard key if the standard key isn't found it returns 'QKeySequence::UnknownKey ' More...
 

Detailed Description

A text editor key map This key map, maps key-sequences to action-names.

Constructor & Destructor Documentation

◆ TextEditorKeyMap()

edbee::TextEditorKeyMap::TextEditorKeyMap ( TextEditorKeyMap parentKeyMap = 0)

◆ ~TextEditorKeyMap()

edbee::TextEditorKeyMap::~TextEditorKeyMap ( )
virtual

the copy constructor

empty the keymap

Member Function Documentation

◆ add() [1/3]

void edbee::TextEditorKeyMap::add ( const QString &  command,
TextEditorKey sequence 
)

Adds the given key sequence to the keymap.

Parameters
commandthe name of the editor command
sequencethe keysequence

◆ add() [2/3]

void edbee::TextEditorKeyMap::add ( const QString &  command,
const QKeySequence &  seq 
)

Adds the given key sequence to the keymap.

Parameters
namethe name of the editor command
sequencethe keysequence

◆ add() [3/3]

bool edbee::TextEditorKeyMap::add ( const QString &  command,
const QString &  seq 
)

Adds a command - key sequence with a string If first tries to match the string with the standardkey-texts If this doesn't result in a sequence it assumes it's a keydefinition used by QKeySequence.

Parameters
commandthe command name
seqthe key sequence definition

◆ copyKeysTo()

void edbee::TextEditorKeyMap::copyKeysTo ( TextEditorKeyMap keyMap)

copies the given keys to the other keymap

Parameters
keyMapthe keymap to copy the keys from

◆ findBySequence()

QString edbee::TextEditorKeyMap::findBySequence ( QKeySequence  sequence,
QKeySequence::SequenceMatch &  match 
)

Searches for the given command with a keysequence Warning when one keysequence is the prefix of the other keysequence it is possible only the partial or full match is return (depending on the order)

Parameters
sequencethe pressed key-sequence
matchthe sequence match: (NoMatch, PartialMatch, ExactMatch)
Returns
the (partial) matched command or a empty string if not found

◆ get()

TextEditorKey * edbee::TextEditorKeyMap::get ( const QString &  name) const

Returns the last inserted keysequence for the given command It also tries to search the parent keymap if it's available.

Parameters
namethe name of the given command
Returns
the keysequence or 0 if not found

◆ getAll()

QList< TextEditorKey * > edbee::TextEditorKeyMap::getAll ( const QString &  name) const

Returns al list of all keysequences for the given command This method will also search the parents for the given keysequences.

◆ getSequence()

QKeySequence edbee::TextEditorKeyMap::getSequence ( const QString &  name) const

Returns the key sequence for the given name.

Parameters
namethe name of the key sequence
Returns
a QKeySequence

◆ has()

bool edbee::TextEditorKeyMap::has ( const QString &  name) const

Tests if the keymap has the given action It will also search the parent key map.

◆ joinKeySequences()

QKeySequence edbee::TextEditorKeyMap::joinKeySequences ( const QKeySequence  seq1,
const QKeySequence  seq2 
)
static

This method joins 2 key-sequences to 1 sequence (if possible) if seq1 + se2 length > 4 seq2 is returned.

◆ parentMap()

TextEditorKeyMap* edbee::TextEditorKeyMap::parentMap ( )
inline

◆ replace()

void edbee::TextEditorKeyMap::replace ( const QString &  name,
TextEditorKey sequence 
)

replace the given command with the given key sequence all other keysequences (on this level) are ignored

◆ standardKeyFromString()

QKeySequence::StandardKey edbee::TextEditorKeyMap::standardKeyFromString ( const QString &  str)
static

converts a string to a standard key if the standard key isn't found it returns 'QKeySequence::UnknownKey '

◆ toString()

QString edbee::TextEditorKeyMap::toString ( ) const

returns all added actions


The documentation for this class was generated from the following files: