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

The line style item delegate for rendering the styles. More...

#include <KoLineStyleItemDelegate_p.h>

+ Inheritance diagram for KoLineStyleItemDelegate:

Public Member Functions

 KoLineStyleItemDelegate (QObject *parent=0)
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
 ~KoLineStyleItemDelegate () override
 

Detailed Description

The line style item delegate for rendering the styles.

Definition at line 12 of file KoLineStyleItemDelegate_p.h.

Constructor & Destructor Documentation

◆ KoLineStyleItemDelegate()

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

Definition at line 12 of file KoLineStyleItemDelegate.cpp.

13 : QAbstractItemDelegate(parent)
14{
15}

◆ ~KoLineStyleItemDelegate()

KoLineStyleItemDelegate::~KoLineStyleItemDelegate ( )
inlineoverride

Definition at line 16 of file KoLineStyleItemDelegate_p.h.

16{}

Member Function Documentation

◆ paint()

void KoLineStyleItemDelegate::paint ( QPainter * painter,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

Definition at line 17 of file KoLineStyleItemDelegate.cpp.

18{
19 painter->save();
20
21 if (option.state & QStyle::State_Selected)
22 painter->fillRect(option.rect, option.palette.highlight());
23
24 QPen pen = index.data(Qt::DecorationRole).value<QPen>();
25 pen.setBrush(option.palette.text()); // use the view-specific palette; the model hardcodes this to black
26 painter->setPen(pen);
27 painter->drawLine(option.rect.left(), option.rect.center().y(), option.rect.right(), option.rect.center().y());
28
29 painter->restore();
30}

◆ sizeHint()

QSize KoLineStyleItemDelegate::sizeHint ( const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

Definition at line 32 of file KoLineStyleItemDelegate.cpp.

33{
34 return QSize(100, 15);
35}

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