[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project

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]

List of all members.

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 KLFLibResourceEngine * resource ()
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 QMimeData * mimeData (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::entryId > entryIdForIndexList (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 KLFLibEntrySorter * entrySorter ()
 The current KLFLibEntrySorter that sorts our items.
virtual void setEntrySorter (KLFLibEntrySorter *entrySorter)

Static Public Member Functions

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

Friends

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

Classes

struct  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

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.

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.


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

static int KLFLibModel::entryItemRole ( int  propertyId  )  [inline, static]

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  )  [inline, static]

inverse operation of entryItemRole

Definition at line 494 of file klflibview.h.

Referenced by data().

void KLFLibModel::setResource ( KLFLibResourceEngine *  resource  )  [virtual]

Definition at line 1554 of file klflibview.cpp.

References KLF_DEBUG_ASSIGN_SAME_REF_INSTANCE, KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

Referenced by KLFLibModel().

virtual KLFLibResourceEngine* KLFLibModel::resource (  )  [inline, virtual]

Definition at line 498 of file klflibview.h.

Referenced by KLFLibViewDelegate::paint().

QUrl KLFLibModel::url (  )  const [virtual]

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.
  m->setFlavorFlags(KLFLibModel::LinearList, KLFLibModel::DisplayTypeMask);
  // Set, and respectively unset the group sub-categories flag (no change to other flags)
  m->setFlavorFlags(KLFLibModel::GroupSubCategories, KLFLibModel::GroupSubCategories);
  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().

uint KLFLibModel::flavorFlags (  )  const [virtual]

Definition at line 1600 of file klflibview.cpp.

uint KLFLibModel::displayType (  )  const [inline]

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

QVariant KLFLibModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const [virtual]

Qt::ItemFlags KLFLibModel::flags ( const QModelIndex &  index  )  const [virtual]

bool KLFLibModel::hasChildren ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

QVariant KLFLibModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) 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.

QModelIndex KLFLibModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const [virtual]

QModelIndex KLFLibModel::parent ( const QModelIndex &  index  )  const [virtual]

int KLFLibModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

int KLFLibModel::columnCount ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

Definition at line 1832 of file klflibview.cpp.

Referenced by KLFLibDefaultView::sortBy().

bool KLFLibModel::canFetchMore ( const QModelIndex &  parent  )  const [virtual]

void KLFLibModel::fetchMore ( const QModelIndex &  parent  )  [virtual]

Qt::DropActions KLFLibModel::supportedDropActions (  )  const [virtual]

Definition at line 1892 of file klflibview.cpp.

QStringList KLFLibModel::mimeTypes (  )  const [virtual]

QMimeData * KLFLibModel::mimeData ( const QModelIndexList &  indexes  )  const [virtual]

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

uint KLFLibModel::dropFlags ( QDragMoveEvent *  event,
QAbstractItemView *  view 
) [virtual]

QImage KLFLibModel::dragImage ( const QModelIndexList &  indexes  )  [virtual]

int KLFLibModel::entryColumnContentsPropertyId ( int  column  )  const [virtual]

int KLFLibModel::columnForEntryPropertyId ( int  entryPropertyId  )  const [virtual]

bool KLFLibModel::isDesendantOf ( const QModelIndex &  child,
const QModelIndex &  ancestor 
) [virtual]

QStringList KLFLibModel::categoryList (  )  const [virtual]

void KLFLibModel::updateData ( const QList< KLFLib::entryId > &  entryIdList,
int  modifyType 
) [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().

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.

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.

QList< KLFLib::entryId > KLFLibModel::entryIdForIndexList ( const QModelIndexList &  indexlist  )  const [virtual]

QModelIndexList KLFLibModel::findEntryIdList ( const QList< KLFLib::entryId > &  eidlist  )  const [virtual]

virtual int KLFLibModel::fetchBatchCount (  )  const [inline, virtual]

Definition at line 567 of file klflibview.h.

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

void KLFLibModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
) [virtual]

virtual KLFLibEntrySorter* KLFLibModel::entrySorter (  )  [inline, virtual]

The current KLFLibEntrySorter that sorts our items.

Definition at line 577 of file klflibview.h.

Referenced by KLFLibModelCache::nodeValue().

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 KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

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::searchFind ( const QString &  queryString,
const QModelIndex &  fromIndex = QModelIndex(),
bool  forward = true 
) [virtual, slot]

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  )  [virtual, slot]

void KLFLibModel::searchAbort (  )  [virtual, slot]

Definition at line 2267 of file klflibview.cpp.

Referenced by KLFLibDefaultView::searchAbort().

void KLFLibModel::completeRefresh (  )  [virtual, slot]

Definition at line 2341 of file klflibview.cpp.

References KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

Referenced by KLFLibDefaultView::slotRefresh().

virtual void KLFLibModel::setFetchBatchCount ( int  count  )  [inline, virtual, slot]

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


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.5.6