[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
Classes | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Friends

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.

Classes

struct  PersistentId

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)

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 1547 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]

Definition at line 1833 of file klflibview.cpp.

Referenced by KLFLibDefaultView::sortBy().

int KLFLibModel::columnForEntryPropertyId ( int  entryPropertyId) const [virtual]
void KLFLibModel::completeRefresh ( ) [virtual, slot]

Definition at line 2342 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 2175 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) [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().

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(), and setEntrySorter().

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

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 2181 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 1601 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 1777 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 1606 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 2349 of file klflibview.cpp.

References KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

Referenced by sort().

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

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

Definition at line 2268 of file klflibview.cpp.

Referenced by KLFLibDefaultView::searchAbort().

QModelIndex KLFLibModel::searchFind ( const QString queryString,
const QModelIndex fromIndex = QModelIndex(),
bool  forward = true 
) [virtual, slot]

Definition at line 2214 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::setEntrySorter ( KLFLibEntrySorter entrySorter) [virtual]
Warning:
The model will take ownership of the sorter and deleted in the destructor.

Definition at line 2199 of file klflibview.cpp.

References entrySorter(), KLF_DEBUG_TIME_BLOCK, and KLF_FUNC_NAME.

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

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 1581 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 1893 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 2161 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 2168 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.7.3