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

#include <kis_paintop_list_widget.h>

+ Inheritance diagram for KisPaintOpListWidget:

Signals

void activated (const QString &)
 
- Signals inherited from KisCategorizedListView
void lockAreaTriggered (const QModelIndex &index)
 
void rightClickedMenuDropSettingsTriggered ()
 
void rightClickedMenuSaveSettingsTriggered ()
 
void sigCategoryToggled (const QModelIndex &index, bool toggled)
 
void sigEntryChecked (const QModelIndex &index)
 

Public Member Functions

QString currentItem () const
 
 KisPaintOpListWidget (QWidget *parent=0, const char *name=0)
 
void setCurrent (const KisPaintOpFactory *op)
 
void setCurrent (const QString &paintOpId)
 
void setPaintOpList (const QList< KisPaintOpFactory * > &list)
 
 ~KisPaintOpListWidget () override
 
- Public Member Functions inherited from KisCategorizedListView
 KisCategorizedListView (QWidget *parent=0)
 
void setCompositeBoxControl (bool value)
 
void setModel (QAbstractItemModel *model) override
 
QSize sizeHint () const override
 
 ~KisCategorizedListView () override
 

Protected Member Functions

QString itemAt (int idx) const
 

Private Slots

void slotOpActivated (const QModelIndex &index)
 

Private Attributes

KisSortedPaintOpListModelm_model
 

Additional Inherited Members

- Protected Slots inherited from KisCategorizedListView
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >()) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) override
 
void rowsInserted (const QModelIndex &parent, int start, int end) override
 
void slotIndexChanged (const QModelIndex &index)
 
void slotScrollerStateChange (QScroller::State state)
 

Detailed Description

A ListBox filled with the paintops

Definition at line 22 of file kis_paintop_list_widget.h.

Constructor & Destructor Documentation

◆ KisPaintOpListWidget()

KisPaintOpListWidget::KisPaintOpListWidget ( QWidget * parent = 0,
const char * name = 0 )

Definition at line 18 of file kis_paintop_list_widget.cpp.

18 :
21{
22 setObjectName(name);
23 connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(slotOpActivated(QModelIndex)));
24
26 setItemDelegate(new KisCategorizedItemDelegate(this));
27}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void setModel(QAbstractItemModel *model) override
KisCategorizedListView(QWidget *parent=0)
void slotOpActivated(const QModelIndex &index)
KisSortedPaintOpListModel * m_model

References connect(), m_model, KisCategorizedListView::setModel(), and slotOpActivated().

◆ ~KisPaintOpListWidget()

KisPaintOpListWidget::~KisPaintOpListWidget ( )
override

Definition at line 29 of file kis_paintop_list_widget.cpp.

30{
31}

Member Function Documentation

◆ activated

void KisPaintOpListWidget::activated ( const QString & )
signal

◆ currentItem()

QString KisPaintOpListWidget::currentItem ( ) const

Definition at line 48 of file kis_paintop_list_widget.cpp.

49{
50 return itemAt(currentIndex().row());
51}
QString itemAt(int idx) const

References itemAt().

◆ itemAt()

QString KisPaintOpListWidget::itemAt ( int idx) const
protected

Definition at line 38 of file kis_paintop_list_widget.cpp.

39{
40 KisPaintOpInfo info;
41
42 if(m_model->entryAt(info, m_model->index(idx, 0)))
43 return info.id;
44
45 return "";
46}
bool entryAt(Entry_Type &entry, QModelIndex index) const

References KisSortedCategorizedListModel< TModel >::entryAt(), KisPaintOpInfo::id, and m_model.

◆ setCurrent() [1/2]

void KisPaintOpListWidget::setCurrent ( const KisPaintOpFactory * op)

Definition at line 53 of file kis_paintop_list_widget.cpp.

54{
55 setCurrentIndex(m_model->indexOf(KisPaintOpInfo(op->id())));
56
57}
virtual QString id() const =0
QModelIndex indexOf(const Entry_Type &entry) const

References KisPaintOpFactory::id(), KisSortedCategorizedListModel< TModel >::indexOf(), and m_model.

◆ setCurrent() [2/2]

void KisPaintOpListWidget::setCurrent ( const QString & paintOpId)

Definition at line 59 of file kis_paintop_list_widget.cpp.

60{
61 setCurrentIndex(m_model->indexOf(KisPaintOpInfo(paintOpId)));
62}

References KisSortedCategorizedListModel< TModel >::indexOf(), and m_model.

◆ setPaintOpList()

void KisPaintOpListWidget::setPaintOpList ( const QList< KisPaintOpFactory * > & list)

Definition at line 33 of file kis_paintop_list_widget.cpp.

34{
35 m_model->fill(list);
36}
void fill(const QList< KisPaintOpFactory * > &list)

References KisSortedPaintOpListModel::fill(), and m_model.

◆ slotOpActivated

void KisPaintOpListWidget::slotOpActivated ( const QModelIndex & index)
privateslot

Definition at line 64 of file kis_paintop_list_widget.cpp.

65{
66 Q_EMIT activated(itemAt(index.row()));
67}
void activated(const QString &)

References activated(), and itemAt().

Member Data Documentation

◆ m_model

KisSortedPaintOpListModel* KisPaintOpListWidget::m_model
private

Definition at line 45 of file kis_paintop_list_widget.h.


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