Scribus
Open source desktop publishing at your fingertips
fontlistmodel.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef FONTLISTMODEL_H
8 #define FONTLISTMODEL_H
9 
10 #include <QAbstractTableModel>
11 #include <QItemDelegate>
12 #include <QPixmap>
13 
14 #include "scfonts.h"
15 
16 class ScribusDoc;
17 
18 
30 class SCRIBUS_API FontListModel : public QAbstractTableModel
31 {
32  Q_OBJECT
33 
34  public:
35  FontListModel(QObject * parent = 0, ScribusDoc * doc = 0);
36 
37  enum ColumnTypes {
38  FontUsable = 0,
39  FontName,
40 // FontFamily,
41 // FontStyle,
42 // FontVariant,
43  FontType,
44  FontFormat,
45  FontEmbed,
46  FontSubset,
47  FontOutline,
48  FontAccess,
49  FontInDoc,
50  FontFile,
51  SortIndex // used for sorting by lowercased name
52  };
53 
56  int rowCount(const QModelIndex&) const;
58  int rowCount();
61  int columnCount(const QModelIndex&) const;
66  QVariant data(const QModelIndex & index,
67  int role = Qt::DisplayRole) const;
70  bool setData(const QModelIndex & index,const QVariant & value,
71  int role = Qt::EditRole);
74  Qt::ItemFlags flags(const QModelIndex &index) const;
75 
77  QList<QString> fonts() { return m_font_names; };
79  void setFonts(QList<QString> f);
80 
84  QString nameForIndex(const QModelIndex & index);
85 
86  bool isLive() const { return m_embedMethod.count() == 0; }
87  private:
88 
89  enum EmbedMethod {
90  DontEmbed = 0,
91  EmbedFont = 1,
92  SubsetFont = 2,
93  OutlineFont = 3
94  };
95 
96  ScribusDoc * m_doc;
98  SCFonts m_fonts;
99  QList<ScFace> m_font_values;
100  QList<QString> m_font_names;
101  QList<EmbedMethod> m_embedMethod;
102 
104  QPixmap ttfFont;
105  QPixmap otfFont;
106  QPixmap psFont;
107  QPixmap substFont;
108 
110  QVariant headerData(int section,
111  Qt::Orientation orientation,
112  int role = Qt::DisplayRole) const;
113 };
114 
115 #endif
the Document Class
Definition: scribusdoc.h:90
QList< QString > fonts()
Returns the font list.
Definition: fontlistmodel.h:77
Model for font views. It contains quite all informations about fonts available to display in Qt4 view...
Definition: fontlistmodel.h:30
Main class SCFonts. Subclass of QDict. This class replaces the previous SCFonts typedef...
Definition: scfonts.h:36