QGIS/python/core/auto_generated/qgsbrowsermodel.sip.in
Denis Rouzaud ba8a445850 run sipify
2021-03-22 21:13:52 +01:00

254 lines
7.9 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsbrowsermodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsBrowserModel : QAbstractItemModel
{
%Docstring(signature="appended")
A model for showing available data sources and other items in a structured
tree.
:py:class:`QgsBrowserModel` is the foundation for the QGIS browser panel, and includes
items for the different data providers and folders accessible to users.
:py:class:`QgsBrowserModel` models are not initially populated and use a deferred initialization
approach. After constructing a :py:class:`QgsBrowserModel`, a call must be made
to :py:func:`~initialize` in order to populate the model.
.. note::
Since QGIS 3.10 it is recommended to use :py:class:`QgsBrowserGuiModel` from GUI library.
Implementation of data items used from :py:class:`QgsBrowserModel` should not trigger any GUI
operations such as opening of widgets/dialogs or showing message boxes. Such actions
should be implemented in a new :py:class:`QgsDataItemGuiProvider` subclass which is used
by :py:class:`QgsBrowserGuiModel` (but not by :py:class:`QgsBrowserModel`).
%End
%TypeHeaderCode
#include "qgsbrowsermodel.h"
%End
public:
explicit QgsBrowserModel( QObject *parent = 0 );
%Docstring
Constructor for QgsBrowserModel, with the specified ``parent`` object.
.. note::
QgsBrowserModel models are not initially populated and use a deferred initialization
approach. After constructing a QgsBrowserModel, a call must be made
to :py:func:`~QgsBrowserModel.initialize` in order to populate the model.
%End
~QgsBrowserModel();
enum ItemDataRole
{
PathRole,
CommentRole,
SortRole,
ProviderKeyRole,
};
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
virtual int columnCount( 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 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 bool hasChildren( const QModelIndex &parent = QModelIndex() ) const;
virtual bool canFetchMore( const QModelIndex &parent ) const;
virtual void fetchMore( const QModelIndex &parent );
QModelIndex findItem( QgsDataItem *item, QgsDataItem *parent = 0 ) const;
%Docstring
Returns the model index corresponding to the specified data ``item``.
If the item was not found, an invalid QModelIndex is returned.
If the ``parent`` item is argument is specified, then only items which are children
of ``parent`` are searched. If no ``parent`` is specified, then all items within
the model are searched.
%End
QgsDataItem *dataItem( const QModelIndex &idx ) const;
%Docstring
Returns the data item at the specified index, or ``None`` if no item
exists at the index.
%End
void refresh( const QString &path );
%Docstring
Refresh item specified by path
%End
void refresh( const QModelIndex &index = QModelIndex() );
%Docstring
Refresh item children
%End
QModelIndex findPath( const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly );
%Docstring
Returns index of item with given path. It only searches in currently fetched
items, i.e. it does not fetch children.
:param path: item path
:param matchFlag: supported 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).
:return: model index, invalid if item not found
%End
QModelIndex findUri( const QString &uri, QModelIndex index = QModelIndex() );
%Docstring
Returns index of layer item with given uri. It only searches in currently fetched
items, i.e. it does not fetch children.
:param uri: item uri
:param index: the current index of the parent (to search for children)
:return: model index, invalid if item not found
.. versionadded:: 3.6
%End
void connectItem( QgsDataItem *item ) /Deprecated/;
%Docstring
.. deprecated::
Deprecated since QGIS 3.4 -- this method has no effect, and is dangerous to call in earlier QGIS versions. Any usage should be removed (and will have no harmful side-effects!).
%End
bool initialized() const;
%Docstring
Returns ``True`` if the model has been initialized.
.. seealso:: :py:func:`initialize`
%End
QMap<QString, QgsDirectoryItem *> driveItems() const;
%Docstring
Returns a map of the root drive items shown in the browser.
These correspond to the top-level directory items shown, e.g. on Windows the C:\, D:\, etc,
and on Linux the "/" root directory.
.. versionadded:: 3.6
%End
signals:
void stateChanged( const QModelIndex &index, QgsDataItem::State oldState );
%Docstring
Emitted when item children fetch was finished
%End
void connectionsChanged( const QString &providerKey );
%Docstring
Emitted when connections for the specified ``providerKey`` have changed in the browser.
Forwarded to the widget and used to notify the provider dialogs of a changed connection.
%End
public slots:
void reload();
%Docstring
Reload the whole model
%End
void refreshDrives();
%Docstring
Refreshes the list of drive items, removing any corresponding to removed
drives and adding newly added drives.
.. versionadded:: 3.4
%End
void beginInsertItems( QgsDataItem *parent, int first, int last );
void endInsertItems();
void beginRemoveItems( QgsDataItem *parent, int first, int last );
void endRemoveItems();
void itemDataChanged( QgsDataItem *item );
void itemStateChanged( QgsDataItem *item, QgsDataItem::State oldState );
void addFavoriteDirectory( const QString &directory, const QString &name = QString() );
%Docstring
Adds a ``directory`` to the favorites group.
If ``name`` is specified, it will be used as the favorite's name. Otherwise
the name will be set to match ``directory``.
.. seealso:: :py:func:`removeFavorite`
.. versionadded:: 3.0
%End
void removeFavorite( const QModelIndex &index );
%Docstring
Removes a favorite directory from its corresponding model index.
.. seealso:: :py:func:`addFavoriteDirectory`
.. versionadded:: 3.0
%End
void updateProjectHome();
void hidePath( QgsDataItem *item );
%Docstring
Hide the given path in the browser model
%End
void initialize();
%Docstring
Delayed initialization, needed because the provider registry must be already populated.
.. seealso:: :py:func:`initialized`
%End
protected:
void addRootItems();
%Docstring
Populates the model
%End
void removeRootItems();
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsbrowsermodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/