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

#include <TextPropertyConfigModel.h>

+ Inheritance diagram for TextPropertyConfigFilterModel:

Signals

void filteredNamesChanged ()
 
void proxySourceModelChanged ()
 
void showParagraphPropertiesChanged ()
 

Public Member Functions

QStringList filteredNames () const
 
void setProxySourceModel (QAbstractItemModel *model)
 
void setShowParagraphProperties (const bool show)
 
bool showParagraphProperties () const
 
 TextPropertyConfigFilterModel (QObject *parent=nullptr)
 

Protected Member Functions

bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override
 

Protected Attributes

bool m_showParagraphProperties
 

Properties

QStringList filteredNames
 
bool showParagraphProperties
 
QAbstractItemModel * sourceModel
 

Detailed Description

Definition at line 84 of file TextPropertyConfigModel.h.

Constructor & Destructor Documentation

◆ TextPropertyConfigFilterModel()

TextPropertyConfigFilterModel::TextPropertyConfigFilterModel ( QObject * parent = nullptr)

Definition at line 183 of file TextPropertyConfigModel.cpp.

184 : QSortFilterProxyModel(parent) {
185
186 connect(this, &QAbstractItemModel::rowsRemoved, this, &TextPropertyConfigFilterModel::filteredNamesChanged);
187 connect(this, &QAbstractItemModel::rowsInserted, this, &TextPropertyConfigFilterModel::filteredNamesChanged);
188}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))

References connect(), and filteredNamesChanged().

Member Function Documentation

◆ filterAcceptsRow()

bool TextPropertyConfigFilterModel::filterAcceptsRow ( int source_row,
const QModelIndex & source_parent ) const
overrideprotected

Definition at line 218 of file TextPropertyConfigModel.cpp.

219{
220 QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
221 if (!idx.isValid()) return false;
222
224 if (state == TextPropertyConfigModel::NeverVisible) return false;
225
228 return false;
230 return false;
231 }
232
233 const QString name = sourceModel()->data(idx, Qt::DisplayRole).toString();
234 const QStringList searchTerms = sourceModel()->data(idx, TextPropertyConfigModel::SearchTerms).toStringList();
235
236 return (name.contains(filterRegularExpression()) || searchTerms.filter(filterRegularExpression()).size()>0);
237}
@ Character
This property can be applied on a character level.
@ Paragraph
This property only does something when applied to a paragraph.
@ NeverVisible
Never show property.
const char * name(StandardAction id)
int toInt(const QString &str, bool *ok=nullptr)
int size(const Forest< T > &forest)
Definition KisForest.h:1232

References TextPropertyConfigModel::Character, m_showParagraphProperties, TextPropertyConfigModel::NeverVisible, TextPropertyConfigModel::Paragraph, TextPropertyConfigModel::SearchTerms, sourceModel, TextPropertyConfigModel::Type, and TextPropertyConfigModel::Visibility.

◆ filteredNames()

QStringList TextPropertyConfigFilterModel::filteredNames ( ) const

Definition at line 207 of file TextPropertyConfigModel.cpp.

208{
209 QStringList names;
210
211 for (int i = 0; i < rowCount(); i++) {
212 QModelIndex idx = index(i, 0);
213 names.append(data(idx, TextPropertyConfigModel::Name).toString());
214 }
215 return names;
216}
QString toString(const QString &value)

References TextPropertyConfigModel::Name.

◆ filteredNamesChanged

void TextPropertyConfigFilterModel::filteredNamesChanged ( )
signal

◆ proxySourceModelChanged

void TextPropertyConfigFilterModel::proxySourceModelChanged ( )
signal

◆ setProxySourceModel()

void TextPropertyConfigFilterModel::setProxySourceModel ( QAbstractItemModel * model)

Definition at line 201 of file TextPropertyConfigModel.cpp.

201 {
202 if (sourceModel() == model) return;
203 setSourceModel(model);
205}

References proxySourceModelChanged(), and sourceModel.

◆ setShowParagraphProperties()

void TextPropertyConfigFilterModel::setShowParagraphProperties ( const bool show)

Definition at line 194 of file TextPropertyConfigModel.cpp.

194 {
195 if (m_showParagraphProperties == show) return;
197 invalidateFilter();
199}

References m_showParagraphProperties, and showParagraphPropertiesChanged().

◆ showParagraphProperties()

bool TextPropertyConfigFilterModel::showParagraphProperties ( ) const

Definition at line 190 of file TextPropertyConfigModel.cpp.

190 {
192}

References m_showParagraphProperties.

◆ showParagraphPropertiesChanged

void TextPropertyConfigFilterModel::showParagraphPropertiesChanged ( )
signal

Member Data Documentation

◆ m_showParagraphProperties

bool TextPropertyConfigFilterModel::m_showParagraphProperties
protected

Definition at line 109 of file TextPropertyConfigModel.h.

Property Documentation

◆ filteredNames

QStringList TextPropertyConfigFilterModel::filteredNames
read

Definition at line 89 of file TextPropertyConfigModel.h.

◆ showParagraphProperties

bool TextPropertyConfigFilterModel::showParagraphProperties
readwrite

Definition at line 87 of file TextPropertyConfigModel.h.

◆ sourceModel

QAbstractItemModel * TextPropertyConfigFilterModel::sourceModel
readwrite

Definition at line 88 of file TextPropertyConfigModel.h.


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