Public Types | Public Slots | Signals | Public Member Functions | Public Attributes

# QKeySequenceWidget Class Reference

The QKeySequenceWidget is a widget to input a QKeySequence. More...

`#include <qkeysequencewidget/src/qkeysequencewidget.h>`

List of all members.

## Public Types
enum | ClearButton { NoShow = 0x00, ShowLeft = 0x01, ShowRight = 0x02 }
## Public Slots
void | setKeySequence (const QKeySequence &key)
void | clearKeySequence ()
void | setNoneText (const QString text)
void | setClearButtonIcon (const QIcon &icon)
void | setClearButtonShow (QKeySequenceWidget::ClearButtonShow show)
## Signals
void | keySequenceChanged (const QKeySequence &seq)
void | keyNotSupported ()
## Public Member Functions
| QKeySequenceWidget (QWidget *parent=0)
| QKeySequenceWidget (QKeySequence seq, QWidget *parent=0)
| QKeySequenceWidget (QString noneString, QWidget *parent=0)
| QKeySequenceWidget (QKeySequence seq, QString noneString, QWidget *parent=0)
virtual | ~QKeySequenceWidget ()
QSize | sizeHint () const
void | setToolTip (const QString &tip)
QKeySequence | keySequence () const
QString | noneText () const
QIcon | clearButtonIcon () const
QKeySequenceWidget::ClearButtonShow | clearButtonShow () const
## Public Attributes
| ClearButtonShow

## Detailed Description

The QKeySequenceWidget is a widget to input a QKeySequence.

This widget lets the user choose a QKeySequence, which is usually used as a shortcut key. The recording is initiated by calling captureKeySequence() or the user clicking into the widget.

        // create new QKeySequenceWidget with empty sequence
        QKeySequenceWidget *keyWidget = new QKeySequenceWidget;

        // Set sequence as "Ctrl+Alt+Space"
        keyWidget->setJeySequence(QKeySequence("Ctrl+Alt+Space"));

        // set clear button position is left
        setClearButtonShow(QKeySequenceWidget::ShowLeft);

        // set cutom clear button icon
        setClearButtonIcon(QIcon("/path/to/icon.png"));

        // connecting keySequenceChanged signal to slot
        connect(keyWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(slotKeySequenceChanged(QKeySequence)));

## Member Enumeration Documentation

enum ClearButton

Modes of sohow ClearButton.

Enumerator:

  NoShow | Hide ClearButton
  ShowLeft | ClearButton isow is left
  ShowRight | ClearButton isow is left

## Constructor & Destructor Documentation

QKeySequenceWidget | ( | QWidget * | parent = `0` | ) | `[explicit]`

Creates a QKeySequenceWidget object wuth parent and empty keySequence

QKeySequenceWidget | ( | QKeySequence | seq,
|  | QWidget * | parent = `0` |
| ) |  |  | `[explicit]`

Creates a QKeySequenceWidget object wuth parent and keysequence keySequence

QKeySequenceWidget | ( | QString | noneString,
|  | QWidget * | parent = `0` |
| ) |  |  | `[explicit]`

Creates a QKeySequenceWidget object wuth parent and string for noneString

QKeySequenceWidget | ( | QKeySequence | seq,
|  | QString | noneString,
|  | QWidget * | parent = `0` |
| ) |  |  | `[explicit]`

Creates a QKeySequenceWidget object wuth parent and keysequence keySequence and string for noneString

~QKeySequenceWidget | ( |  | ) | `[virtual]`

Destroy a QKeySequenceWidget object

## Member Function Documentation

QIcon clearButtonIcon | ( |  | ) | const

Get clear buttom icon.

Returns:
  QIcon object

QKeySequenceWidget::ClearButtonShow clearButtonShow | ( |  | ) | const

Return mode of clear button dosplay.

Parameters:

  | show | Dysplay mode of clear button (NoShow, ShowLeft or ShorRight)

void clearKeySequence | ( |  | ) | `[slot]`

Clear key sequence.

QKeySequence keySequence | ( |  | ) | const

Get current key sequence.

Returns:
  Current key sequenc

QString noneText | ( |  | ) | const

Get string for display when key sequence is undefined.

Returns:
  Text string

void setClearButtonIcon | ( | const QIcon & | icon | ) | `[slot]`

Set custom icon for clear buttom.

Parameters:

  | icon | QIcon object

void setClearButtonShow | ( | QKeySequenceWidget::ClearButtonShow | show | ) | `[slot]`

Setting mode of Clear Buttorn display.

Parameters:

  | show | Position of clear button ClearButtornShow

void setKeySequence | ( | const QKeySequence & | key | ) | `[slot]`

Set the key sequence.

Parameters:

  | key | Key sequence

See also:
  clearKeySequence

void setNoneText | ( | const QString | text | ) | `[slot]`

Set string for display when key sequence is undefined.

Parameters:

  | text | Text string