Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

CharTableModel Class Reference

A model (MVC) to handle unicode characters map. It's a backend for CharTableView - its GUI representation. More...

#include <chartablemodel.h>

Collaboration diagram for CharTableModel:

Collaboration graph
[legend]

List of all members.

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

ScribusDocm_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!
Author:
Petr Vanek <petr@scribus.info>

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 
)

Definition at line 15 of file chartablemodel.cpp.

References m_characters, and m_selectionModel.


Member Function Documentation

int CharTableModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const

Definition at line 26 of file chartablemodel.cpp.

References m_characters, m_cols, and m_doc.

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

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  ) 

CharClassDef CharTableModel::characters (  )  [inline]

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]

Definition at line 54 of file chartablemodel.h.

Referenced by CharTableView::resizeEvent().

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]

Definition at line 172 of file chartablemodel.cpp.

References data().

bool CharTableModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
) [private]

Definition at line 179 of file chartablemodel.cpp.

References appendUnicode().


Member Data Documentation

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().

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().

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:
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.