Krita Source Code Documentation
Loading...
Searching...
No Matches
KisKeyInputEditor Class Reference

An editor widget for a list of keys. More...

#include <kis_key_input_editor.h>

+ Inheritance diagram for KisKeyInputEditor:

Classes

class  Private
 

Public Member Functions

Qt::MouseButtons buttons () const
 
QList< Qt::Key > keys () const
 
 KisKeyInputEditor (QWidget *parent=nullptr)
 
void setButtons (Qt::MouseButtons newButtons)
 
void setKeys (const QList< Qt::Key > &newKeys)
 
 ~KisKeyInputEditor () override
 

Private Slots

void updateLabel ()
 

Private Attributes

Private *const d {nullptr}
 

Detailed Description

An editor widget for a list of keys.

Definition at line 21 of file kis_key_input_editor.h.

Constructor & Destructor Documentation

◆ KisKeyInputEditor()

KisKeyInputEditor::KisKeyInputEditor ( QWidget * parent = nullptr)

Definition at line 26 of file kis_key_input_editor.cpp.

27 : QPushButton(parent), d(new Private)
28{
29 QWidget *popup = new QWidget();
30
31 d->ui = new Ui::KisKeyInputEditor;
32 d->ui->setupUi(popup);
33
34 d->ui->clearKeysButton->setIcon(KisIconUtils::loadIcon("edit-clear"));
35
36 QWidgetAction *action = new QWidgetAction(this);
37 action->setDefaultWidget(popup);
38
39 QMenu *menu = new QMenu(this);
40 menu->addAction(action);
41 setMenu(menu);
42
43 QTimer::singleShot(0, this, SLOT(showMenu()));
44
45 connect(d->ui->keysButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
46 connect(d->ui->clearKeysButton, SIGNAL(clicked(bool)), d->ui->keysButton, SLOT(clear()));
47}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
QAction * clear(const QObject *recvr, const char *slot, QObject *parent)
QIcon loadIcon(const QString &name)

References connect(), d, KisIconUtils::loadIcon(), KisKeyInputEditor::Private::ui, and updateLabel().

◆ ~KisKeyInputEditor()

KisKeyInputEditor::~KisKeyInputEditor ( )
override

Definition at line 49 of file kis_key_input_editor.cpp.

50{
51 delete d->ui;
52 delete d;
53}

References d, and KisKeyInputEditor::Private::ui.

Member Function Documentation

◆ buttons()

Qt::MouseButtons KisKeyInputEditor::buttons ( ) const

◆ keys()

QList< Qt::Key > KisKeyInputEditor::keys ( ) const

Definition at line 55 of file kis_key_input_editor.cpp.

56{
57 return d->ui->keysButton->keys();
58}

References d, and KisKeyInputEditor::Private::ui.

◆ setButtons()

void KisKeyInputEditor::setButtons ( Qt::MouseButtons newButtons)

◆ setKeys()

void KisKeyInputEditor::setKeys ( const QList< Qt::Key > & newKeys)

Definition at line 60 of file kis_key_input_editor.cpp.

61{
62 d->ui->keysButton->setKeys(newKeys);
64}

References d, KisKeyInputEditor::Private::ui, and updateLabel().

◆ updateLabel

void KisKeyInputEditor::updateLabel ( )
privateslot

Definition at line 66 of file kis_key_input_editor.cpp.

67{
68 setText(KisShortcutConfiguration::keysToText(d->ui->keysButton->keys()));
69}
static QString keysToText(const QList< Qt::Key > &keys)
void setText(QSpinBox *spinBox, const QStringView textTemplate)

References d, KisShortcutConfiguration::keysToText(), and KisKeyInputEditor::Private::ui.

Member Data Documentation

◆ d

Private* const KisKeyInputEditor::d {nullptr}
private

Definition at line 39 of file kis_key_input_editor.h.

39{nullptr};

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