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

An editor widget for mouse wheel input with modifiers. More...

#include <kis_wheel_input_editor.h>

+ Inheritance diagram for KisWheelInputEditor:

Classes

class  Private
 

Public Member Functions

QList< Qt::Key > keys () const
 
 KisWheelInputEditor (QWidget *parent=nullptr)
 
void setKeys (const QList< Qt::Key > &newKeys)
 
void setWheel (KisShortcutConfiguration::MouseWheelMovement newWheel)
 
KisShortcutConfiguration::MouseWheelMovement wheel () const
 
 ~KisWheelInputEditor () override
 

Private Slots

void updateLabel ()
 

Private Attributes

Private *const d {nullptr}
 

Detailed Description

An editor widget for mouse wheel input with modifiers.

Definition at line 23 of file kis_wheel_input_editor.h.

Constructor & Destructor Documentation

◆ KisWheelInputEditor()

KisWheelInputEditor::KisWheelInputEditor ( QWidget * parent = nullptr)

Definition at line 25 of file kis_wheel_input_editor.cpp.

26 : QPushButton(parent), d(new Private)
27{
28 QWidget *popup = new QWidget();
29
30 d->ui = new Ui::KisWheelInputEditor;
31 d->ui->setupUi(popup);
32 d->ui->wheelButton->setType(KisInputButton::WheelType);
33
34 d->ui->clearModifiersButton->setIcon(KisIconUtils::loadIcon("edit-clear"));
35 d->ui->clearWheelButton->setIcon(KisIconUtils::loadIcon("edit-clear"));
36
37 QWidgetAction *action = new QWidgetAction(this);
38 action->setDefaultWidget(popup);
39
40 QMenu *menu = new QMenu(this);
41 menu->addAction(action);
42 setMenu(menu);
43
44 QTimer::singleShot(0, this, SLOT(showMenu()));
45
46 connect(d->ui->wheelButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
47 connect(d->ui->modifiersButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
48 connect(d->ui->clearWheelButton, SIGNAL(clicked(bool)), d->ui->wheelButton, SLOT(clear()));
49 connect(d->ui->clearModifiersButton, SIGNAL(clicked(bool)), d->ui->modifiersButton, SLOT(clear()));
50}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
@ WheelType
Detect and store mouse wheel movement.
QAction * clear(const QObject *recvr, const char *slot, QObject *parent)
QIcon loadIcon(const QString &name)

References connect(), d, KisIconUtils::loadIcon(), KisWheelInputEditor::Private::ui, updateLabel(), and KisInputButton::WheelType.

◆ ~KisWheelInputEditor()

KisWheelInputEditor::~KisWheelInputEditor ( )
override

Definition at line 52 of file kis_wheel_input_editor.cpp.

53{
54 delete d->ui;
55 delete d;
56}

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

Member Function Documentation

◆ keys()

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

Definition at line 58 of file kis_wheel_input_editor.cpp.

59{
60 return d->ui->modifiersButton->keys();
61}

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

◆ setKeys()

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

Definition at line 63 of file kis_wheel_input_editor.cpp.

64{
65 d->ui->modifiersButton->setKeys(newKeys);
67}

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

◆ setWheel()

void KisWheelInputEditor::setWheel ( KisShortcutConfiguration::MouseWheelMovement newWheel)

Definition at line 74 of file kis_wheel_input_editor.cpp.

75{
76 d->ui->wheelButton->setWheel(newWheel);
78}

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

◆ updateLabel

void KisWheelInputEditor::updateLabel ( )
privateslot

Definition at line 80 of file kis_wheel_input_editor.cpp.

81{
83 d->ui->modifiersButton->keys(),
84 d->ui->wheelButton->wheel()));
85}
static QString wheelInputToText(const QList< Qt::Key > &keys, MouseWheelMovement wheel)
void setText(QSpinBox *spinBox, const QStringView textTemplate)

References d, KisWheelInputEditor::Private::ui, and KisShortcutConfiguration::wheelInputToText().

◆ wheel()

KisShortcutConfiguration::MouseWheelMovement KisWheelInputEditor::wheel ( ) const

Definition at line 69 of file kis_wheel_input_editor.cpp.

70{
71 return d->ui->wheelButton->wheel();
72}

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

Member Data Documentation

◆ d

Private* const KisWheelInputEditor::d {nullptr}
private

Definition at line 41 of file kis_wheel_input_editor.h.

41{nullptr};

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