File: qgsbrowsermodel.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (269 lines) | stat: -rw-r--r-- 8,303 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/browser/qgsbrowsermodel.h                                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py 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 class CustomRole /BaseType=IntEnum/
      {
      Path,
      Comment,
      Sort,
      ProviderKey,
      LayerMetadata,
    };


    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:: 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

    QVector<QgsDataItem *> rootItems() const;
%Docstring
Returns the root items for the model.

.. versionadded:: 3.28
%End

  signals:

    void stateChanged( const QModelIndex &index, Qgis::BrowserItemState 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, Qgis::BrowserItemState oldState );
%Docstring
Emitted when an ``item``'s state is changed.
%End

    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`
%End

    void removeFavorite( const QModelIndex &index );
%Docstring
Removes a favorite directory from its corresponding model index.

.. seealso:: :py:func:`addFavoriteDirectory`
%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/browser/qgsbrowsermodel.h                                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/