BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
ShortcutCatcher Class Reference

Represents extra widget for changing single keyboard shortcut. More...

#include <shortcutcatcher.h>

Collaboration diagram for ShortcutCatcher:
Collaboration graph

Public Slots

void resetShortcut ()
 Resets active shortcut to default shortcut.
 
void clearShortcut ()
 Clears current active shortcut.
 

Signals

void shortcutChanged (const QKeySequence &seguence)
 

Public Member Functions

 ShortcutCatcher (QWidget *parent=0)
 Constructor. More...
 
void controlModifierlessTimeout ()
 Performs time-dependent check of current shortcut check and stops the recording if time is up.
 
void updateDisplayShortcut ()
 Updates text displayed in catcher according to active shortcut.
 
QKeySequence shortcut () const
 Access to active shortcut. More...
 
void setDefaultShortcut (const QKeySequence &key)
 Sets default shortcut for the widget. More...
 
void setShortcut (const QKeySequence &key)
 Sets active shortcut for the widget. More...
 

Protected Slots

void startRecording ()
 
void doneRecording ()
 

Friends

class ShortcutButton
 
class DynamicShortcutsWidget
 

Detailed Description

Represents extra widget for changing single keyboard shortcut.

Definition at line 41 of file shortcutcatcher.h.

Constructor & Destructor Documentation

ShortcutCatcher::ShortcutCatcher ( QWidget *  parent = 0)
explicit

Constructor.

Parameters
parentPointer to parent widget.

Definition at line 38 of file shortcutcatcher.cpp.

39  : QWidget(parent) {
40  // Setup layout of the control
41  m_layout = new QHBoxLayout(this);
42  m_layout->setMargin(0);
43  m_layout->setSpacing(1);
44 
45  // Create reset button.
46  m_btnReset = new PlainToolButton(this);
47  m_btnReset->setIcon(IconFactory::instance()->fromTheme("edit-revert"));
48  m_btnReset->setFocusPolicy(Qt::NoFocus);
49  m_btnReset->setToolTip(tr("Reset to original shortcut."));
50 
51  // Create clear button.
52  m_btnClear = new PlainToolButton(this);
53  m_btnClear->setIcon(IconFactory::instance()->fromTheme("item-remove"));
54  m_btnClear->setFocusPolicy(Qt::NoFocus);
55  m_btnClear->setToolTip(tr("Clear current shortcut."));
56 
57  // Clear main shortcut catching button.
58  m_btnChange = new ShortcutButton(this);
59  m_btnChange->setFocusPolicy(Qt::StrongFocus);
60  m_btnChange->setToolTip(tr("Click and hit new shortcut."));
61 
62  // Add both buttons to the layout.
63  m_layout->addWidget(m_btnChange);
64  m_layout->addWidget(m_btnReset);
65  m_layout->addWidget(m_btnClear);
66 
67  // Establish needed connections.
68  connect(m_btnReset, SIGNAL(clicked()), this, SLOT(resetShortcut()));
69  connect(m_btnClear, SIGNAL(clicked()), this, SLOT(clearShortcut()));
70  connect(m_btnChange, SIGNAL(clicked()), this, SLOT(startRecording()));
71 
72  // Prepare initial state of the control.
74 }
void updateDisplayShortcut()
Updates text displayed in catcher according to active shortcut.
void resetShortcut()
Resets active shortcut to default shortcut.
Tool button without frame.
void clearShortcut()
Clears current active shortcut.
Represents single button for changing keyboard shortcut.
static IconFactory * instance()
Singleton getter.
Definition: iconfactory.cpp:48

Here is the call graph for this function:

Member Function Documentation

void ShortcutCatcher::setDefaultShortcut ( const QKeySequence &  key)
inline

Sets default shortcut for the widget.

Parameters
keyShortcut to set.

Definition at line 68 of file shortcutcatcher.h.

68  {
69  m_defaultSequence = key;
70  setShortcut(key);
71  }
void setShortcut(const QKeySequence &key)
Sets active shortcut for the widget.

Here is the call graph for this function:

Here is the caller graph for this function:

void ShortcutCatcher::setShortcut ( const QKeySequence &  key)
inline

Sets active shortcut for the widget.

Parameters
keyShortcut to set.

Definition at line 75 of file shortcutcatcher.h.

75  {
76  m_currentSequence = key;
77  doneRecording();
78  }

Here is the caller graph for this function:

QKeySequence ShortcutCatcher::shortcut ( ) const
inline

Access to active shortcut.

Returns
Returns active shortcut.

Definition at line 62 of file shortcutcatcher.h.

62  {
63  return m_currentSequence;
64  }

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