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

#include <OpenTypeFeatureModel.h>

+ Inheritance diagram for AllOpenTypeFeaturesModel:

Classes

struct  Private
 

Public Types

enum  Roles { Tag = Qt::UserRole + 1 , Sample , Available }
 

Public Member Functions

 AllOpenTypeFeaturesModel (QObject *parent=nullptr)
 
QVariant data (const QModelIndex &index, int role) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 
QHash< int, QByteArray > roleNames () const override
 
int rowCount (const QModelIndex &parent) const override
 
void setAvailableFeatures (const QList< KoOpenTypeFeatureInfo > &features)
 
 ~AllOpenTypeFeaturesModel ()
 

Private Attributes

const QScopedPointer< Privated
 

Detailed Description

Definition at line 125 of file OpenTypeFeatureModel.h.

Member Enumeration Documentation

◆ Roles

Enumerator
Tag 
Sample 
Available 

Definition at line 130 of file OpenTypeFeatureModel.h.

Constructor & Destructor Documentation

◆ AllOpenTypeFeaturesModel()

AllOpenTypeFeaturesModel::AllOpenTypeFeaturesModel ( QObject * parent = nullptr)

Definition at line 293 of file OpenTypeFeatureModel.cpp.

294 : QAbstractListModel(parent)
295 , d(new Private)
296{
297
298}
const QScopedPointer< Private > d

◆ ~AllOpenTypeFeaturesModel()

AllOpenTypeFeaturesModel::~AllOpenTypeFeaturesModel ( )

Definition at line 300 of file OpenTypeFeatureModel.cpp.

301{
302
303}

Member Function Documentation

◆ data()

QVariant AllOpenTypeFeaturesModel::data ( const QModelIndex & index,
int role ) const
override

Definition at line 313 of file OpenTypeFeatureModel.cpp.

314{
315 if (!index.isValid())
316 return QVariant();
317
318 const QString feature = d->allTags.at(index.row());
319 KoOpenTypeFeatureInfo info = d->featureByTag(QLatin1String(feature.toLatin1(), 4));
320 if (role == Qt::DisplayRole) {
321 return info.name;
322 } else if (role == Qt::ToolTipRole) {
323 return info.description;
324 } else if (role == Tag) {
325 return feature;
326 } else if (role == Sample) {
327 return info.sample;
328 } else if (role == Available) {
329 return d->featureAvailable(feature);
330 }
331 return QVariant();
332}
QString description
Description of the feature.
QString name
User-friendly name.
QString sample
Sample of the feature, if any. Only used by CVXX features and retrieved from the font.

References Available, d, KoOpenTypeFeatureInfo::description, KoOpenTypeFeatureInfo::name, KoOpenTypeFeatureInfo::sample, Sample, and Tag.

◆ headerData()

QVariant AllOpenTypeFeaturesModel::headerData ( int section,
Qt::Orientation orientation,
int role ) const

Definition at line 340 of file OpenTypeFeatureModel.cpp.

341{
342 if (role == Qt::DisplayRole) {
343 if (orientation == Qt::Horizontal && section == 0) {
344 return i18nc("@title:column", "OpenType Feature Tag");
345 }
346 }
347 return QVariant();
348}

◆ roleNames()

QHash< int, QByteArray > AllOpenTypeFeaturesModel::roleNames ( ) const
override

Definition at line 350 of file OpenTypeFeatureModel.cpp.

351{
352 QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
353 roles[Tag] = "tag";
354 roles[Sample] = "sample";
355 roles[Available] = "available";
356 return roles;
357}

References Available, Sample, and Tag.

◆ rowCount()

int AllOpenTypeFeaturesModel::rowCount ( const QModelIndex & parent) const
override

Definition at line 334 of file OpenTypeFeatureModel.cpp.

335{
336 Q_UNUSED(parent)
337 return d->allTags.size();
338}

References d.

◆ setAvailableFeatures()

void AllOpenTypeFeaturesModel::setAvailableFeatures ( const QList< KoOpenTypeFeatureInfo > & features)

Definition at line 305 of file OpenTypeFeatureModel.cpp.

306{
307 beginResetModel();
308 d->availableFeatures = features;
309 d->setAvailableTags();
310 endResetModel();
311}

References d.

Member Data Documentation

◆ d

const QScopedPointer<Private> AllOpenTypeFeaturesModel::d
private

Definition at line 147 of file OpenTypeFeatureModel.h.


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