chartablemodel.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef CHARTABLEMODEL_H
00008 #define CHARTABLEMODEL_H
00009
00010 #include <QAbstractTableModel>
00011
00012 #include "scribusapi.h"
00013
00014 class ScribusDoc;
00015 class ScFace;
00016 class QItemSelectionModel;
00017
00018
00020 typedef QList<uint> CharClassDef;
00021
00022
00028 class SCRIBUS_API CharTableModel : public QAbstractTableModel
00029 {
00030 Q_OBJECT
00031
00032 public:
00033 CharTableModel(QObject *parent = 0, int cols = 4, ScribusDoc * doc = 0, const QString & font = 0);
00034
00035 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00036 int columnCount(const QModelIndex &parent = QModelIndex()) const;
00037
00039 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00040
00041 void setFontInUse(QString font);
00042
00044 ScFace fontFace();
00045
00046 void setCharacters(CharClassDef ch);
00047 CharClassDef characters() { return m_characters; };
00048
00050 bool removeCharacter(int index);
00051
00052 void setDoc(ScribusDoc *doc);
00053
00054 void setViewWidth(int w) { m_viewWidth = w; };
00055
00056 public slots:
00064 void appendUnicode(QString s, uint base = 16);
00065
00066 signals:
00070 void selectionChanged(QItemSelectionModel * model);
00071
00072 private:
00073 ScribusDoc *m_doc;
00075 int m_cols;
00077 int m_viewWidth;
00078
00079 QString m_fontInUse;
00080 CharClassDef m_characters;
00081
00083 QItemSelectionModel * m_selectionModel;
00084
00088 Qt::ItemFlags flags(const QModelIndex &index) const;
00089 Qt::DropActions supportedDropActions() const;
00090 QStringList mimeTypes() const;
00091 QMimeData * mimeData(const QModelIndexList &indexes) const;
00092 bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
00093 };
00094
00095 #endif