[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
Classes | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Friends | List of all members
KLFLibModel Class Reference

Model for Item-Views displaying a library resource's contents. More...

#include <klflibview.h>

Inheritance diagram for KLFLibModel:
Inheritance graph
[legend]
Collaboration diagram for KLFLibModel:
Collaboration graph
[legend]

Public Types

enum  FlavorFlag {
  LinearList = 0x0001, IconViewList = LinearList, CategoryTree = 0x0002, DisplayTypeMask = 0x000f,
  GroupSubCategories = 0x1000
}
 
enum  ItemKind { EntryKind, CategoryLabelKind }
 
enum  {
  ItemKindItemRole = Qt::UserRole+768, EntryContentsTypeItemRole, EntryIdItemRole, FullEntryItemRole,
  CategoryLabelItemRole, FullCategoryPathItemRole
}
 
enum  { DropWillAccept = 0x0001, DropWillCategorize = 0x0002, DropWillMove = 0x0004 }
 

Public Slots

virtual QModelIndex searchFind (const QString &queryString, const QModelIndex &fromIndex=QModelIndex(), bool forward=true)
 
virtual QModelIndex searchFindNext (bool forward)
 
virtual void searchAbort ()
 
virtual void completeRefresh ()
 
virtual void setFetchBatchCount (int count)
 

Signals

void operationStartReportingProgress (KLFProgressReporter *progressReporter, const QString &descriptiveText)
 

Public Member Functions

 KLFLibModel (KLFLibResourceEngine *resource, uint flavorFlags=LinearList|GroupSubCategories, QObject *parent=NULL)
 
virtual ~KLFLibModel ()
 
virtual void setResource (KLFLibResourceEngine *resource)
 
virtual KLFLibResourceEngineresource ()
 
virtual QUrl url () const
 
virtual void setFlavorFlags (uint flags, uint modify_mask=0xffffffff)
 
virtual uint flavorFlags () const
 
uint displayType () const
 
virtual void prefetch (const QModelIndexList &index) const
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 
virtual bool hasChildren (const QModelIndex &parent=QModelIndex()) const
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
virtual bool hasIndex (int row, int column, const QModelIndex &parent=QModelIndex()) const
 
virtual QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 
virtual QModelIndex parent (const QModelIndex &index) const
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 
virtual bool canFetchMore (const QModelIndex &parent) const
 
virtual void fetchMore (const QModelIndex &parent)
 
virtual Qt::DropActions supportedDropActions () const
 
virtual QStringList mimeTypes () const
 
virtual QMimeDatamimeData (const QModelIndexList &indexes) const
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 
virtual uint dropFlags (QDragMoveEvent *event, QAbstractItemView *view)
 
virtual QImage dragImage (const QModelIndexList &indexes)
 
virtual int entryColumnContentsPropertyId (int column) const
 
virtual int columnForEntryPropertyId (int entryPropertyId) const
 
virtual bool isDesendantOf (const QModelIndex &child, const QModelIndex &ancestor)
 
virtual QStringList categoryList () const
 
virtual void updateData (const QList< KLFLib::entryId > &entryIdList, int modifyType)
 
virtual QModelIndex walkNextIndex (const QModelIndex &cur)
 Call repeatedly to walk all indexes (once each exactly, first column only)
 
virtual QModelIndex walkPrevIndex (const QModelIndex &cur)
 Call repeatedly to walk all indexes in model in reverse order.
 
virtual KLFLib::entryId entryIdForIndex (const QModelIndex &index) const
 
virtual QModelIndex findEntryId (KLFLib::entryId eid) const
 
virtual QList< KLFLib::entryIdentryIdForIndexList (const QModelIndexList &indexlist) const
 
virtual QModelIndexList findEntryIdList (const QList< KLFLib::entryId > &eidlist) const
 
virtual int fetchBatchCount () const
 
virtual void redoSort ()
 notify the model that the entrySorter() settings were changed, and we need to re-sort.
 
virtual void sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
 change the entrySorter accordingly and re-sort the model.
 
virtual KLFLibEntrySorterentrySorter ()
 The current KLFLibEntrySorter that sorts our items.
 
virtual void setEntrySorter (KLFLibEntrySorter *entrySorter)
 
- Public Member Functions inherited from QAbstractItemModel
 QAbstractItemModel (QObject *parent=0)
 
 beginInsertColumns (const QModelIndex &parent, int first, int last)
 
 beginInsertRows (const QModelIndex &parent, int first, int last)
 
 beginRemoveColumns (const QModelIndex &parent, int first, int last)
 
 beginRemoveRows (const QModelIndex &parent, int first, int last)
 
 buddy (const QModelIndex &index)
 
 canFetchMore (const QModelIndex &parent)
 
 changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
 
 changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
 
 columnCount (const QModelIndex &parent=QModelIndex()
 
 columnsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
 columnsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
 columnsInserted (const QModelIndex &parent, int start, int end)
 
 columnsRemoved (const QModelIndex &parent, int start, int end)
 
 createIndex (int row, int column, void *ptr=0)
 
 createIndex (int row, int column, quint32 id)
 
 data (const QModelIndex &index, int role=Qt::DisplayRole)
 
 dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
 dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 
 endInsertColumns ()
 
 endInsertRows ()
 
 endRemoveColumns ()
 
 endRemoveRows ()
 
 fetchMore (const QModelIndex &parent)
 
 ItemFlags QAbstractItemModel::flags(const QModelIndex &index)
 
 hasChildren (const QModelIndex &parent=QModelIndex()
 
 hasIndex (int row, int column, const QModelIndex &parent=QModelIndex()
 
 headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole)
 
 headerDataChanged (Qt::Orientation orientation, int first, int last)
 
 index (int row, int column, const QModelIndex &parent=QModelIndex()
 
 insertColumn (int column, const QModelIndex &parent=QModelIndex()
 
 insertColumns (int column, int count, const QModelIndex &parent=QModelIndex()
 
 insertRow (int row, const QModelIndex &parent=QModelIndex()
 
 insertRows (int row, int count, const QModelIndex &parent=QModelIndex()
 
 itemData (const QModelIndex &index)
 
 layoutAboutToBeChanged ()
 
 layoutChanged ()
 
 match (const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)
 
 mimeData (const QModelIndexList &indexes)
 
 mimeTypes ()
 
 modelAboutToBeReset ()
 
 modelReset ()
 
 parent (const QModelIndex &index)
 
 persistentIndexList ()
 
 removeColumn (int column, const QModelIndex &parent=QModelIndex()
 
 removeColumns (int column, int count, const QModelIndex &parent=QModelIndex()
 
 removeRow (int row, const QModelIndex &parent=QModelIndex()
 
 removeRows (int row, int count, const QModelIndex &parent=QModelIndex()
 
 reset ()
 
 revert ()
 
 rowCount (const QModelIndex &parent=QModelIndex()
 
 rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
 rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
 rowsInserted (const QModelIndex &parent, int start, int end)
 
 rowsRemoved (const QModelIndex &parent, int start, int end)
 
 setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 
 setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)
 
 setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)
 
 setSupportedDragActions (Qt::DropActions actions)
 
 sibling (int row, int column, const QModelIndex &index)
 
 sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
 
 span (const QModelIndex &index)
 
 submit ()
 
 DropActions QAbstractItemModel::supportedDragActions()
 
 DropActions QAbstractItemModel::supportedDropActions()
 
 horizontalStepsPerItem ()
 
 setHorizontalStepsPerItem (int steps)
 
 setVerticalStepsPerItem (int steps)
 
 verticalStepsPerItem ()
 

Static Public Member Functions

static int entryItemRole (int propertyId)
 
static int entryPropIdForItemRole (int role)
 

Friends

QDebug & operator<< (QDebug &, const PersistentId &)
 

Detailed Description

Model for Item-Views displaying a library resource's contents.

The Model can morph into different forms, for simulating various common & useful displays (chronological list (history), category/tags tree (archive), maybe icons in the future, ...).

Definition at line 459 of file klflibview.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
ItemKindItemRole 
EntryContentsTypeItemRole 
EntryIdItemRole 
FullEntryItemRole 
CategoryLabelItemRole 
FullCategoryPathItemRole 

Definition at line 477 of file klflibview.h.

anonymous enum
Enumerator:
DropWillAccept 
DropWillCategorize 
DropWillMove 

Definition at line 541 of file klflibview.h.

Enumerator:
LinearList 
IconViewList 
CategoryTree 
DisplayTypeMask 
GroupSubCategories 

Definition at line 463 of file klflibview.h.

Enumerator:
EntryKind 
CategoryLabelKind 

Definition at line 476 of file klflibview.h.

Constructor & Destructor Documentation

KLFLibModel::KLFLibModel ( KLFLibResourceEngine resource,
uint  flavorFlags = LinearList|GroupSubCategories,
QObject parent = NULL 
)
KLFLibModel::~KLFLibModel ( )
virtual

Definition at line 1546 of file klflibview.cpp.

References KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

Member Function Documentation

bool KLFLibModel::canFetchMore ( const QModelIndex parent) const
virtual
QStringList KLFLibModel::categoryList ( ) const
virtual
int KLFLibModel::columnCount ( const QModelIndex parent = QModelIndex()) const
virtual
int KLFLibModel::columnForEntryPropertyId ( int  entryPropertyId) const
virtual
void KLFLibModel::completeRefresh ( )
virtualslot

Definition at line 2341 of file klflibview.cpp.

References KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

Referenced by KLFLibDefaultView::slotRefresh().

QVariant KLFLibModel::data ( const QModelIndex index,
int  role = Qt::DisplayRole 
) const
virtual
uint KLFLibModel::displayType ( ) const
inline
QImage KLFLibModel::dragImage ( const QModelIndexList &  indexes)
virtual
uint KLFLibModel::dropFlags ( QDragMoveEvent event,
QAbstractItemView view 
)
virtual
bool KLFLibModel::dropMimeData ( const QMimeData data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex parent 
)
virtual
int KLFLibModel::entryColumnContentsPropertyId ( int  column) const
virtual
KLFLib::entryId KLFLibModel::entryIdForIndex ( const QModelIndex index) const
virtual

Definition at line 2174 of file klflibview.cpp.

References entryIdForIndexList(), KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

QList< KLFLib::entryId > KLFLibModel::entryIdForIndexList ( const QModelIndexList &  indexlist) const
virtual
static int KLFLibModel::entryItemRole ( int  propertyId)
inlinestatic

For example use

to get LaTeX string for model index index.

Definition at line 492 of file klflibview.h.

Referenced by data(), KLFLibViewDelegate::paintEntry(), and KLFLibViewDelegate::sizeHint().

static int KLFLibModel::entryPropIdForItemRole ( int  role)
inlinestatic

inverse operation of entryItemRole

Definition at line 494 of file klflibview.h.

Referenced by data().

virtual KLFLibEntrySorter* KLFLibModel::entrySorter ( )
inlinevirtual

The current KLFLibEntrySorter that sorts our items.

Definition at line 577 of file klflibview.h.

Referenced by KLFLibModelCache::nodeValue(), and setEntrySorter().

virtual int KLFLibModel::fetchBatchCount ( ) const
inlinevirtual

Definition at line 567 of file klflibview.h.

void KLFLibModel::fetchMore ( const QModelIndex parent)
virtual
QModelIndex KLFLibModel::findEntryId ( KLFLib::entryId  eid) const
virtual

Definition at line 2180 of file klflibview.cpp.

References findEntryIdList(), KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

QModelIndexList KLFLibModel::findEntryIdList ( const QList< KLFLib::entryId > &  eidlist) const
virtual
Qt::ItemFlags KLFLibModel::flags ( const QModelIndex index) const
virtual
uint KLFLibModel::flavorFlags ( ) const
virtual

Definition at line 1600 of file klflibview.cpp.

bool KLFLibModel::hasChildren ( const QModelIndex parent = QModelIndex()) const
virtual
bool KLFLibModel::hasIndex ( int  row,
int  column,
const QModelIndex parent = QModelIndex() 
) const
virtual

Definition at line 1776 of file klflibview.cpp.

References index(), QModelIndex::isValid(), KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

QVariant KLFLibModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual
QModelIndex KLFLibModel::index ( int  row,
int  column,
const QModelIndex parent = QModelIndex() 
) const
virtual
bool KLFLibModel::isDesendantOf ( const QModelIndex child,
const QModelIndex ancestor 
)
virtual
QMimeData * KLFLibModel::mimeData ( const QModelIndexList &  indexes) const
virtual
QStringList KLFLibModel::mimeTypes ( ) const
virtual
void KLFLibModel::operationStartReportingProgress ( KLFProgressReporter progressReporter,
const QString descriptiveText 
)
signal

Announces the beginning of a long operation (used for updates in updateData())

Referenced by KLFLibModelCache::rebuildCache(), and KLFLibModelCache::updateData().

QModelIndex KLFLibModel::parent ( const QModelIndex index) const
virtual
void KLFLibModel::prefetch ( const QModelIndexList &  index) const
virtual

ensures that the cache nodes of the given index list are not 'minimalist'

Definition at line 1605 of file klflibview.cpp.

References KLFLibModelCache::ensureNotMinimalist(), KLFLibModelCache::getNodeForIndex(), KLFLibModelCache::NodeId::isRoot(), KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfDbg, and KLFLibModelCache::NodeId::valid().

void KLFLibModel::redoSort ( )
virtual

notify the model that the entrySorter() settings were changed, and we need to re-sort.

Definition at line 2348 of file klflibview.cpp.

References KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

Referenced by sort().

virtual KLFLibResourceEngine* KLFLibModel::resource ( )
inlinevirtual

Definition at line 498 of file klflibview.h.

Referenced by KLFLibViewDelegate::paint(), and setResource().

int KLFLibModel::rowCount ( const QModelIndex parent = QModelIndex()) const
virtual
void KLFLibModel::searchAbort ( )
virtualslot

Definition at line 2267 of file klflibview.cpp.

Referenced by KLFLibDefaultView::searchAbort().

QModelIndex KLFLibModel::searchFind ( const QString queryString,
const QModelIndex fromIndex = QModelIndex(),
bool  forward = true 
)
virtualslot

Definition at line 2213 of file klflibview.cpp.

References KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfDbg, and searchFindNext().

Referenced by KLFLibDefaultView::searchFind().

QModelIndex KLFLibModel::searchFindNext ( bool  forward)
virtualslot
void KLFLibModel::setEntrySorter ( KLFLibEntrySorter entrySorter)
virtual
Warning
The model will take ownership of the sorter and deleted in the destructor.

Definition at line 2198 of file klflibview.cpp.

References entrySorter(), KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

virtual void KLFLibModel::setFetchBatchCount ( int  count)
inlinevirtualslot

how many items to fetch at a time when fetching preview and style (non-minimalist)

Definition at line 600 of file klflibview.h.

Referenced by KLFLibModel(), and KLFLibDefaultView::showEvent().

void KLFLibModel::setFlavorFlags ( uint  flags,
uint  modify_mask = 0xffffffff 
)
virtual

sets the flavor flags given by flags. Only flags masked by modify_mask are affected. Examples:

// Display type set to LinearList. GroupSubCategories is unchanged.
// Set, and respectively unset the group sub-categories flag (no change to other flags)
m->setFlavorFlags(0, KLFLibModel::GroupSubCategories);

Definition at line 1580 of file klflibview.cpp.

References columnForEntryPropertyId(), DisplayTypeMask, GroupSubCategories, KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, KLFLibEntrySorter::order(), KLFLibEntrySorter::propId(), and sort().

void KLFLibModel::setResource ( KLFLibResourceEngine resource)
virtual
void KLFLibModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)
virtual
Qt::DropActions KLFLibModel::supportedDropActions ( ) const
virtual

Definition at line 1892 of file klflibview.cpp.

void KLFLibModel::updateData ( const QList< KLFLib::entryId > &  entryIdList,
int  modifyType 
)
virtual
QUrl KLFLibModel::url ( ) const
virtual
QModelIndex KLFLibModel::walkNextIndex ( const QModelIndex cur)
virtual

Call repeatedly to walk all indexes (once each exactly, first column only)

Definition at line 2160 of file klflibview.cpp.

References KLFLibModelCache::createIndexFromId(), KLFLibModelCache::getNodeForIndex(), KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, and KLFLibModelCache::nextNode().

Referenced by KLFLibDefViewCommon::curVisibleIndex().

QModelIndex KLFLibModel::walkPrevIndex ( const QModelIndex cur)
virtual

Call repeatedly to walk all indexes in model in reverse order.

Definition at line 2167 of file klflibview.cpp.

References KLFLibModelCache::createIndexFromId(), KLFLibModelCache::getNodeForIndex(), KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, and KLFLibModelCache::prevNode().

Referenced by KLFLibDefaultView::searchFind().

Friends And Related Function Documentation

QDebug& operator<< ( QDebug &  dbg,
const PersistentId &  n 
)
friend

Definition at line 369 of file klflibview.cpp.


The documentation for this class was generated from the following files:

Generated by doxygen 1.8.2