Scribus
Open source desktop publishing at your fingertips
|
Model for font views. It contains quite all informations about fonts available to display in Qt4 views. It's suggested to use custom FontListView. More...
#include <fontlistmodel.h>
Public Types | |
enum | ColumnTypes { FontUsable = 0, FontName, FontType, FontFormat, FontEmbed, FontSubset, FontOutline, FontAccess, FontInDoc, FontFile, SortIndex } |
Public Member Functions | |
FontListModel (QObject *parent=0, ScribusDoc *doc=0) | |
int | rowCount (const QModelIndex &) const |
int | rowCount () |
The same behaviour as the previous one. | |
int | columnCount (const QModelIndex &) const |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
Qt::ItemFlags | flags (const QModelIndex &index) const |
QList< QString > | fonts () |
Returns the font list. | |
void | setFonts (QList< QString > f) |
Sets font list and refresh the model. This will detach the model from the main Scribus font list! | |
QString | nameForIndex (const QModelIndex &index) |
bool | isLive () const |
Model for font views. It contains quite all informations about fonts available to display in Qt4 views. It's suggested to use custom FontListView.
You can call view->hideColumn(ColumnType) to hide unneeded columns for user.
When user edits the allowed items (see flags()) it's promoted directly into the doc/prefs.
int FontListModel::columnCount | ( | const QModelIndex & | ) | const |
Required inherited method. See Qt4 docs. It must return the count of ColumnTypes items
QVariant FontListModel::data | ( | const QModelIndex & | index, |
int | role = Qt::DisplayRole |
||
) | const |
Required inherited method. See Qt4 docs. It handles displaying for user itself. the Qt::CheckStateRole stuff is handling user input. And should not be removed.
Qt::ItemFlags FontListModel::flags | ( | const QModelIndex & | index | ) | const |
Setup features for all columns. Only here named columns are able to be edited by user.
QString FontListModel::nameForIndex | ( | const QModelIndex & | index | ) |
Get the font name for current index.
int FontListModel::rowCount | ( | const QModelIndex & | ) | const |
Required inherited method. See Qt4 docs. It returns the count of fonts.
bool FontListModel::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role = Qt::EditRole |
||
) |
It handles user inputs. Only Qt::CheckStateRole should be allowed. No additional delegates are presented.