QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsBrowserModel Class Reference

#include <qgsbrowsermodel.h>

Inheritance diagram for QgsBrowserModel:
Inheritance graph
[legend]

Public Slots

void addFavouriteDirectory (QString favDir)
 
void beginInsertItems (QgsDataItem *parent, int first, int last)
 
void beginRemoveItems (QgsDataItem *parent, int first, int last)
 
void childrenCreated (QgsDataItem *item, QVector< QgsDataItem * > items)
 
void endInsertItems ()
 
void endRemoveItems ()
 
void loadingFrameChanged ()
 
void refreshChildrenCreated (QgsDataItem *item, QVector< QgsDataItem * > items)
 
void reload ()
 
void removeFavourite (const QModelIndex &index)
 
void updateProjectHome ()
 

Signals

void fetchFinished (const QModelIndex &index)
 Emitted when item children fetch was finished. More...
 

Public Member Functions

 QgsBrowserModel (QObject *parent=0)
 
 ~QgsBrowserModel ()
 
bool canFetchMore (const QModelIndex &parent) const
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 Provides the number of columns of data exposed by the model. More...
 
void connectItem (QgsDataItem *item)
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Used to supply item data to views and delegates. More...
 
QgsDataItemdataItem (const QModelIndex &idx) const
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 Handles the data supplied by a drag and drop operation that ended with the given action. More...
 
bool fetching (QgsDataItem *item) const
 
void fetchMore (const QModelIndex &parent)
 
QModelIndex findItem (QgsDataItem *item, QgsDataItem *parent=0) const
 
QModelIndex findPath (QString path, Qt::MatchFlag matchFlag=Qt::MatchExactly)
 Return index of item with given path. More...
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 Used by other components to obtain information about each item provided by the model. More...
 
bool hasChildren (const QModelIndex &parent=QModelIndex()) const
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Provides views with information to show in their headers. More...
 
virtual QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Returns the index of the item in the model specified by the given row, column and parent index. More...
 
virtual QMimeData * mimeData (const QModelIndexList &indexes) const
 Returns an object that contains serialized items of data corresponding to the list of indexes specified. More...
 
virtual QStringList mimeTypes () const
 Returns a list of mime that can describe model indexes. More...
 
virtual QModelIndex parent (const QModelIndex &index) const
 Returns the parent of the model item with the given index. More...
 
void refresh (QString path)
 
void refresh (const QModelIndex &index=QModelIndex())
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 Provides the number of rows of data exposed by the model. More...
 

Static Public Member Functions

static QVector< QgsDataItem * > createChildren (QgsDataItem *item)
 

Protected Member Functions

void addRootItems ()
 
void removeRootItems ()
 

Protected Attributes

QgsFavouritesItemmFavourites
 
QgsDirectoryItemmProjectHome
 
QVector< QgsDataItem * > mRootItems
 

Detailed Description

Definition at line 51 of file qgsbrowsermodel.h.

Constructor & Destructor Documentation

QgsBrowserModel::QgsBrowserModel ( QObject *  parent = 0)
explicit

Definition at line 62 of file qgsbrowsermodel.cpp.

QgsBrowserModel::~QgsBrowserModel ( )

Definition at line 75 of file qgsbrowsermodel.cpp.

Member Function Documentation

void QgsBrowserModel::addFavouriteDirectory ( QString  favDir)
slot

Definition at line 608 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::addRootItems ( )
protected

Definition at line 107 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::beginInsertItems ( QgsDataItem parent,
int  first,
int  last 
)
slot

Definition at line 388 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::beginRemoveItems ( QgsDataItem parent,
int  first,
int  last 
)
slot

Definition at line 403 of file qgsbrowsermodel.cpp.

bool QgsBrowserModel::canFetchMore ( const QModelIndex &  parent) const

Definition at line 476 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::childrenCreated ( QgsDataItem item,
QVector< QgsDataItem * >  items 
)
slot

Definition at line 556 of file qgsbrowsermodel.cpp.

int QgsBrowserModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Provides the number of columns of data exposed by the model.

List models do not provide this function because it is already implemented in QAbstractListModel.

Definition at line 301 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::connectItem ( QgsDataItem item)

Definition at line 416 of file qgsbrowsermodel.cpp.

QVector< QgsDataItem * > QgsBrowserModel::createChildren ( QgsDataItem item)
static

Definition at line 534 of file qgsbrowsermodel.cpp.

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

Used to supply item data to views and delegates.

Generally, models only need to supply data for Qt::DisplayRole and any application-specific user roles, but it is also good practice to provide data for Qt::ToolTipRole, Qt::AccessibleTextRole, and Qt::AccessibleDescriptionRole. See the Qt::ItemDataRole enum documentation for information about the types associated with each role.

Definition at line 230 of file qgsbrowsermodel.cpp.

QgsDataItem * QgsBrowserModel::dataItem ( const QModelIndex &  idx) const

Definition at line 468 of file qgsbrowsermodel.cpp.

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

Handles the data supplied by a drag and drop operation that ended with the given action.

Definition at line 453 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::endInsertItems ( )
slot

Definition at line 398 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::endRemoveItems ( )
slot

Definition at line 411 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::fetchFinished ( const QModelIndex &  index)
signal

Emitted when item children fetch was finished.

bool QgsBrowserModel::fetching ( QgsDataItem item) const

Definition at line 577 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::fetchMore ( const QModelIndex &  parent)

Definition at line 484 of file qgsbrowsermodel.cpp.

QModelIndex QgsBrowserModel::findItem ( QgsDataItem item,
QgsDataItem parent = 0 
) const

Definition at line 371 of file qgsbrowsermodel.cpp.

QModelIndex QgsBrowserModel::findPath ( QString  path,
Qt::MatchFlag  matchFlag = Qt::MatchExactly 
)

Return index of item with given path.

It only searches in currently fetched items, i.e. it does not fetch children.

Parameters
pathitem path
matchFlagsupported is Qt::MatchExactly and Qt::MatchStartsWith which has reverse meaning, i.e. find item with the longest match from start with path (to get as close/deep as possible to deleted item).
Returns
model index, invalid if item not found

Definition at line 307 of file qgsbrowsermodel.cpp.

Qt::ItemFlags QgsBrowserModel::flags ( const QModelIndex &  index) const
virtual

Used by other components to obtain information about each item provided by the model.

In many models, the combination of flags should include Qt::ItemIsEnabled and Qt::ItemIsSelectable.

Definition at line 213 of file qgsbrowsermodel.cpp.

bool QgsBrowserModel::hasChildren ( const QModelIndex &  parent = QModelIndex()) const

Definition at line 292 of file qgsbrowsermodel.cpp.

QVariant QgsBrowserModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual

Provides views with information to show in their headers.

The information is only retrieved by views that can display header information.

Definition at line 263 of file qgsbrowsermodel.cpp.

QModelIndex QgsBrowserModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
virtual

Returns the index of the item in the model specified by the given row, column and parent index.

Definition at line 354 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::loadingFrameChanged ( )
slot

Definition at line 587 of file qgsbrowsermodel.cpp.

QMimeData * QgsBrowserModel::mimeData ( const QModelIndexList &  indexes) const
virtual

Returns an object that contains serialized items of data corresponding to the list of indexes specified.

Definition at line 437 of file qgsbrowsermodel.cpp.

QStringList QgsBrowserModel::mimeTypes ( ) const
virtual

Returns a list of mime that can describe model indexes.

Definition at line 428 of file qgsbrowsermodel.cpp.

QModelIndex QgsBrowserModel::parent ( const QModelIndex &  index) const
virtual

Returns the parent of the model item with the given index.

If the item has no parent, an invalid QModelIndex is returned.

Definition at line 362 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::refresh ( QString  path)

Definition at line 508 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::refresh ( const QModelIndex &  index = QModelIndex())

Definition at line 515 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::refreshChildrenCreated ( QgsDataItem item,
QVector< QgsDataItem * >  items 
)
slot

Definition at line 567 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::reload ( )
slot

Definition at line 346 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::removeFavourite ( const QModelIndex &  index)
slot

Definition at line 614 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::removeRootItems ( )
protected

Definition at line 202 of file qgsbrowsermodel.cpp.

int QgsBrowserModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Provides the number of rows of data exposed by the model.

Definition at line 274 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::updateProjectHome ( )
slot

Definition at line 80 of file qgsbrowsermodel.cpp.

Member Data Documentation

QgsFavouritesItem* QgsBrowserModel::mFavourites
protected

Definition at line 152 of file qgsbrowsermodel.h.

QgsDirectoryItem* QgsBrowserModel::mProjectHome
protected

Definition at line 153 of file qgsbrowsermodel.h.

QVector<QgsDataItem*> QgsBrowserModel::mRootItems
protected

Definition at line 151 of file qgsbrowsermodel.h.


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