CharTableModel Class Reference
A model (MVC) to handle unicode characters map. It's a backend for CharTableView - its GUI representation. More...
#include <chartablemodel.h>

Public Slots | |
| void | appendUnicode (QString s, uint base=16) |
| appends an unicode char into m_characters list. | |
Signals | |
| void | selectionChanged (QItemSelectionModel *model) |
| Inform its view about internal selection changes. It's emitted everytime user adds an existing glyph to the CharClassDef list. | |
Public Member Functions | |
| CharTableModel (QObject *parent=0, int cols=4, ScribusDoc *doc=0, const QString &font=0) | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
| Get a graphics representation/pixmap of the glyph. | |
| void | setFontInUse (QString font) |
| ScFace | fontFace () |
| Font in use. It's used in model's view. | |
| void | setCharacters (CharClassDef ch) |
| CharClassDef | characters () |
| bool | removeCharacter (int index) |
| called to erase glyph at index from table. | |
| void | setDoc (ScribusDoc *doc) |
| void | setViewWidth (int w) |
Private Member Functions | |
| Qt::ItemFlags | flags (const QModelIndex &index) const |
| All drag'n'drop actions are handled in this model only See Qt4 docs "Using Drag and Drop with Item Views" for more info. | |
| Qt::DropActions | supportedDropActions () const |
| QStringList | mimeTypes () const |
| QMimeData * | mimeData (const QModelIndexList &indexes) const |
| bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
Private Attributes | |
| ScribusDoc * | m_doc |
| int | m_cols |
| Number of the columns for model. | |
| int | m_viewWidth |
| View's width to compute pixmap sizes. | |
| QString | m_fontInUse |
| CharClassDef | m_characters |
| QItemSelectionModel * | m_selectionModel |
| Internal selection handling. See selectionChanged(). | |
Detailed Description
A model (MVC) to handle unicode characters map. It's a backend for CharTableView - its GUI representation.
- Warning:
- : CharTableModel and CharTableView are designed for 1:1 relations!
Definition at line 28 of file chartablemodel.h.
Constructor & Destructor Documentation
| CharTableModel::CharTableModel | ( | QObject * | parent = 0, |
|
| int | cols = 4, |
|||
| ScribusDoc * | doc = 0, |
|||
| const QString & | font = 0 | |||
| ) |
Member Function Documentation
| int CharTableModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const |
| int CharTableModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const |
Definition at line 31 of file chartablemodel.cpp.
References m_cols.
Referenced by CharTableView::currenCharactersIndex(), and CharTableView::resizeEvent().
| QVariant CharTableModel::data | ( | const QModelIndex & | index, | |
| int | role = Qt::DisplayRole | |||
| ) | const |
Get a graphics representation/pixmap of the glyph.
Definition at line 36 of file chartablemodel.cpp.
References ScribusDoc::AllFonts, ScFace::char2CMap(), ScPainter::clear(), ScFace::descent(), ScPainter::end(), ScPainter::fillPath(), ScFace::glyphOutline(), ScFace::glyphWidth(), m_characters, m_cols, m_doc, m_fontInUse, m_viewWidth, FPointArray::map(), p, ScPainter::setBrush(), ScPainter::setFillMode(), ScPainter::setupPolygon(), FPointArray::size(), and ScPainter::translate().
Referenced by mimeData().
| void CharTableModel::setFontInUse | ( | QString | font | ) |
Definition at line 107 of file chartablemodel.cpp.
References m_fontInUse.
Referenced by CharSelect::newFont().
| ScFace CharTableModel::fontFace | ( | ) |
Font in use. It's used in model's view.
Definition at line 95 of file chartablemodel.cpp.
References ScribusDoc::AllFonts, m_doc, and m_fontInUse.
| void CharTableModel::setCharacters | ( | CharClassDef | ch | ) |
Definition at line 100 of file chartablemodel.cpp.
References m_characters.
Referenced by CharSelect::generatePreview(), StoryEditor::hideEvent(), CharSelect::loadUserContent(), StoryEditor::showEvent(), and CharSelect::uniClearButton_clicked().
| CharClassDef CharTableModel::characters | ( | ) | [inline] |
Definition at line 47 of file chartablemodel.h.
Referenced by StoryEditor::hideEvent(), CharTableView::mousePressEvent(), CharSelect::saveUserContent(), CharSelect::show(), StoryEditor::showEvent(), CharSelect::uniClearButton_clicked(), and CharSelect::uniSaveButton_clicked().
| bool CharTableModel::removeCharacter | ( | int | index | ) |
called to erase glyph at index from table.
Definition at line 142 of file chartablemodel.cpp.
References m_characters.
Referenced by CharTableView::removeCharacter().
| void CharTableModel::setDoc | ( | ScribusDoc * | doc | ) |
Definition at line 86 of file chartablemodel.cpp.
References m_doc.
Referenced by CharSelect::setDoc().
| void CharTableModel::setViewWidth | ( | int | w | ) | [inline] |
| void CharTableModel::appendUnicode | ( | QString | s, | |
| uint | base = 16 | |||
| ) | [slot] |
appends an unicode char into m_characters list.
- Parameters:
-
s a QString with numerical representation of the character. base an optional parameter containing base of the numerical converion. See QString::toInt() documentation. The base parameter is used mainly in normal code - not in slot calls. If user adds an already existing glyph it's rejected and the original one is selected (see selectionChanged()).
Definition at line 116 of file chartablemodel.cpp.
References m_characters, m_cols, m_selectionModel, and selectionChanged().
Referenced by dropMimeData().
| void CharTableModel::selectionChanged | ( | QItemSelectionModel * | model | ) | [signal] |
Inform its view about internal selection changes. It's emitted everytime user adds an existing glyph to the CharClassDef list.
Referenced by appendUnicode().
| Qt::ItemFlags CharTableModel::flags | ( | const QModelIndex & | index | ) | const [private] |
All drag'n'drop actions are handled in this model only See Qt4 docs "Using Drag and Drop with Item Views" for more info.
Definition at line 154 of file chartablemodel.cpp.
| Qt::DropActions CharTableModel::supportedDropActions | ( | ) | const [private] |
Definition at line 162 of file chartablemodel.cpp.
| QStringList CharTableModel::mimeTypes | ( | ) | const [private] |
Definition at line 167 of file chartablemodel.cpp.
| QMimeData * CharTableModel::mimeData | ( | const QModelIndexList & | indexes | ) | const [private] |
| bool CharTableModel::dropMimeData | ( | const QMimeData * | data, | |
| Qt::DropAction | action, | |||
| int | row, | |||
| int | column, | |||
| const QModelIndex & | parent | |||
| ) | [private] |
Member Data Documentation
ScribusDoc* CharTableModel::m_doc [private] |
Definition at line 73 of file chartablemodel.h.
Referenced by data(), fontFace(), rowCount(), and setDoc().
int CharTableModel::m_cols [private] |
Number of the columns for model.
Definition at line 75 of file chartablemodel.h.
Referenced by appendUnicode(), columnCount(), data(), and rowCount().
int CharTableModel::m_viewWidth [private] |
View's width to compute pixmap sizes.
Definition at line 77 of file chartablemodel.h.
Referenced by data().
QString CharTableModel::m_fontInUse [private] |
Definition at line 79 of file chartablemodel.h.
Referenced by data(), fontFace(), and setFontInUse().
CharClassDef CharTableModel::m_characters [private] |
Definition at line 80 of file chartablemodel.h.
Referenced by appendUnicode(), CharTableModel(), data(), removeCharacter(), rowCount(), and setCharacters().
QItemSelectionModel* CharTableModel::m_selectionModel [private] |
Internal selection handling. See selectionChanged().
Definition at line 83 of file chartablemodel.h.
Referenced by appendUnicode(), and CharTableModel().
The documentation for this class was generated from the following files:
