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 | 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 endInsertItems ()
 
void endRemoveItems ()
 
void itemDataChanged (QgsDataItem *item)
 
void itemStateChanged (QgsDataItem *item, QgsDataItem::State oldState)
 
void reload ()
 
void removeFavourite (const QModelIndex &index)
 
void updateProjectHome ()
 

Signals

void stateChanged (const QModelIndex &index, QgsDataItem::State oldState)
 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...
 
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...
 

Protected Member Functions

void addRootItems ()
 
void removeRootItems ()
 

Protected Attributes

QgsFavouritesItemmFavourites
 
QgsDirectoryItemmProjectHome
 
QVector< QgsDataItem * > mRootItems
 

Detailed Description

Definition at line 44 of file qgsbrowsermodel.h.

Constructor & Destructor Documentation

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

Definition at line 47 of file qgsbrowsermodel.cpp.

QgsBrowserModel::~QgsBrowserModel ( )

Definition at line 57 of file qgsbrowsermodel.cpp.

Member Function Documentation

void QgsBrowserModel::addFavouriteDirectory ( QString  favDir)
slot

Definition at line 518 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::addRootItems ( )
protected

Definition at line 89 of file qgsbrowsermodel.cpp.

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

Definition at line 367 of file qgsbrowsermodel.cpp.

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

Definition at line 382 of file qgsbrowsermodel.cpp.

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

Definition at line 478 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 279 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::connectItem ( QgsDataItem item)

Definition at line 414 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 212 of file qgsbrowsermodel.cpp.

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

Definition at line 470 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 455 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::endInsertItems ( )
slot

Definition at line 377 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::endRemoveItems ( )
slot

Definition at line 390 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::fetchMore ( const QModelIndex &  parent)

Definition at line 486 of file qgsbrowsermodel.cpp.

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

Definition at line 350 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 285 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 195 of file qgsbrowsermodel.cpp.

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

Definition at line 270 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 241 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 333 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::itemDataChanged ( QgsDataItem item)
slot

Definition at line 395 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::itemStateChanged ( QgsDataItem item,
QgsDataItem::State  oldState 
)
slot

Definition at line 403 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 439 of file qgsbrowsermodel.cpp.

QStringList QgsBrowserModel::mimeTypes ( ) const
virtual

Returns a list of mime that can describe model indexes.

Definition at line 430 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 341 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::refresh ( QString  path)

Definition at line 500 of file qgsbrowsermodel.cpp.

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

Definition at line 507 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::reload ( )
slot

Definition at line 324 of file qgsbrowsermodel.cpp.

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

Definition at line 524 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::removeRootItems ( )
protected

Definition at line 184 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 252 of file qgsbrowsermodel.cpp.

void QgsBrowserModel::stateChanged ( const QModelIndex &  index,
QgsDataItem::State  oldState 
)
signal

Emitted when item children fetch was finished.

void QgsBrowserModel::updateProjectHome ( )
slot

Definition at line 62 of file qgsbrowsermodel.cpp.

Member Data Documentation

QgsFavouritesItem* QgsBrowserModel::mFavourites
protected

Definition at line 141 of file qgsbrowsermodel.h.

QgsDirectoryItem* QgsBrowserModel::mProjectHome
protected

Definition at line 142 of file qgsbrowsermodel.h.

QVector<QgsDataItem*> QgsBrowserModel::mRootItems
protected

Definition at line 140 of file qgsbrowsermodel.h.


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