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

#include <kis_font_family_combo_box.h>

+ Inheritance diagram for PinnedFontsSeparator:

Public Member Functions

void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
 PinnedFontsSeparator (QAbstractItemDelegate *_default, QWidget *parent=nullptr)
 
void setSeparatorAdded ()
 
void setSeparatorIndex (int index)
 
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 

Private Attributes

QAbstractItemDelegate * m_defaultDelegate
 
bool m_separatorAdded
 
int m_separatorIndex
 

Detailed Description

Definition at line 66 of file kis_font_family_combo_box.h.

Constructor & Destructor Documentation

◆ PinnedFontsSeparator()

PinnedFontsSeparator::PinnedFontsSeparator ( QAbstractItemDelegate * _default,
QWidget * parent = nullptr )

Definition at line 23 of file kis_font_family_combo_box.cpp.

24 : QStyledItemDelegate(parent)
26 , m_separatorAdded(false)
27 , m_defaultDelegate(_default)
28{
29}
QAbstractItemDelegate * m_defaultDelegate

Member Function Documentation

◆ paint()

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

Definition at line 31 of file kis_font_family_combo_box.cpp.

32{
33 if (index.row() == m_separatorIndex && m_separatorAdded) {
34 QRect viewRect = option.rect;
35 painter->setPen(Qt::gray);
36 painter->drawLine((viewRect.topLeft() + viewRect.bottomLeft()) / 2 + QPoint(5, 0),
37 (viewRect.topRight() + viewRect.bottomRight()) / 2 - QPoint(5, 0));
38 } else {
39 m_defaultDelegate->paint(painter, option, index);
40 }
41}

References m_defaultDelegate, m_separatorAdded, and m_separatorIndex.

◆ setSeparatorAdded()

void PinnedFontsSeparator::setSeparatorAdded ( )

Definition at line 53 of file kis_font_family_combo_box.cpp.

54{
55 m_separatorAdded = true;
56}

References m_separatorAdded.

◆ setSeparatorIndex()

void PinnedFontsSeparator::setSeparatorIndex ( int index)

Definition at line 48 of file kis_font_family_combo_box.cpp.

49{
50 m_separatorIndex = index;
51}

References m_separatorIndex.

◆ sizeHint()

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

Definition at line 43 of file kis_font_family_combo_box.cpp.

44{
45 return QStyledItemDelegate::sizeHint(option, index) * 1.25;
46}

Member Data Documentation

◆ m_defaultDelegate

QAbstractItemDelegate* PinnedFontsSeparator::m_defaultDelegate
private

Definition at line 77 of file kis_font_family_combo_box.h.

◆ m_separatorAdded

bool PinnedFontsSeparator::m_separatorAdded
private

Definition at line 76 of file kis_font_family_combo_box.h.

◆ m_separatorIndex

int PinnedFontsSeparator::m_separatorIndex
private

Definition at line 75 of file kis_font_family_combo_box.h.


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