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

A delegate providing editors for the type property of KisShortcutConfiguration. More...

#include <kis_input_type_delegate.h>

+ Inheritance diagram for KisInputTypeDelegate:

Classes

class  Private
 

Public Member Functions

QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override
 
 KisInputTypeDelegate (QObject *parent=0)
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const override
 
 ~KisInputTypeDelegate () override
 

Private Attributes

Private *const d
 

Detailed Description

A delegate providing editors for the type property of KisShortcutConfiguration.

Definition at line 16 of file kis_input_type_delegate.h.

Constructor & Destructor Documentation

◆ KisInputTypeDelegate()

KisInputTypeDelegate::KisInputTypeDelegate ( QObject * parent = 0)
explicit

Definition at line 19 of file kis_input_type_delegate.cpp.

20 : QStyledItemDelegate(parent), d(new Private)
21{
22
23}

◆ ~KisInputTypeDelegate()

KisInputTypeDelegate::~KisInputTypeDelegate ( )
override

Definition at line 25 of file kis_input_type_delegate.cpp.

26{
27 delete d;
28
29}

References d.

Member Function Documentation

◆ createEditor()

QWidget * KisInputTypeDelegate::createEditor ( QWidget * parent,
const QStyleOptionViewItem & ,
const QModelIndex &  ) const
override

Definition at line 31 of file kis_input_type_delegate.cpp.

32{
33 KComboBox *combo = new KComboBox(parent);
34 combo->addItems(QStringList()
40 );
41 combo->setCurrentIndex(0);
42
43 return combo;
44}
QList< QString > QStringList
static QString shortcutTypeToText(ShortcutType type)
@ MouseButtonType
A mouse button, possibly with key modifiers.
@ MouseWheelType
Mouse wheel movement, possibly with key modifiers.
@ KeyCombinationType
A list of keys that should be pressed.

References KisShortcutConfiguration::KeyCombinationType, KisShortcutConfiguration::MouseButtonType, KisShortcutConfiguration::MouseWheelType, KisShortcutConfiguration::NativeGestureType, KisShortcutConfiguration::shortcutTypeToText(), and KisShortcutConfiguration::TouchGestureType.

◆ setEditorData()

void KisInputTypeDelegate::setEditorData ( QWidget * editor,
const QModelIndex & index ) const
override

Definition at line 46 of file kis_input_type_delegate.cpp.

47{
48 KComboBox *combo = qobject_cast<KComboBox *>(editor);
49 Q_ASSERT(combo);
50
51 combo->setCurrentIndex(index.data(Qt::EditRole).toUInt() - 1);
52}

◆ setModelData()

void KisInputTypeDelegate::setModelData ( QWidget * editor,
QAbstractItemModel * model,
const QModelIndex & index ) const
override

Definition at line 54 of file kis_input_type_delegate.cpp.

55{
56 KComboBox *combo = qobject_cast<KComboBox *>(editor);
57 Q_ASSERT(combo);
58 model->setData(index, combo->currentIndex() + 1, Qt::EditRole);
59}

◆ updateEditorGeometry()

void KisInputTypeDelegate::updateEditorGeometry ( QWidget * editor,
const QStyleOptionViewItem & option,
const QModelIndex &  ) const
override

Definition at line 61 of file kis_input_type_delegate.cpp.

62{
63 editor->setGeometry(option.rect);
64}

Member Data Documentation

◆ d

Private* const KisInputTypeDelegate::d
private

Definition at line 30 of file kis_input_type_delegate.h.


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