Skip to content

Commit c9e6f15

Browse files
authoredJun 2, 2017
Merge pull request #4659 from boundlessgeo/browser-to-gui
Move QgsBrowserDockWidget from app to gui
2 parents 2d78ef8 + d62d444 commit c9e6f15

10 files changed

+897
-529
lines changed
 

‎python/gui/gui.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
%Include qgsattributeforminterface.sip
2828
%Include qgsattributetypeloaddialog.sip
2929
%Include qgsbrowsertreeview.sip
30+
%Include qgsbrowserdockwidget.sip
3031
%Include qgsbusyindicatordialog.sip
3132
%Include qgscollapsiblegroupbox.sip
3233
%If (HAVE_QSCI_SIP)

‎python/gui/qgsbrowserdockwidget.sip

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsbrowserdockwidget.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsBrowserDockWidget : QgsDockWidget
13+
{
14+
%Docstring
15+
The QgsBrowserDockWidget class
16+
.. versionadded:: 3.0
17+
%End
18+
19+
%TypeHeaderCode
20+
#include "qgsbrowserdockwidget.h"
21+
%End
22+
public:
23+
24+
explicit QgsBrowserDockWidget( const QString &name, QWidget *parent /TransferThis/ = 0 );
25+
%Docstring
26+
Constructor for QgsBrowserDockWidget
27+
\param name name of the widget
28+
\param parent parent widget
29+
%End
30+
~QgsBrowserDockWidget();
31+
void addFavoriteDirectory( const QString &favDir );
32+
%Docstring
33+
Add directory to favorites
34+
%End
35+
36+
public slots:
37+
void addLayerAtIndex( const QModelIndex &index );
38+
%Docstring
39+
Add layer at index
40+
%End
41+
void showContextMenu( QPoint );
42+
%Docstring
43+
Show context menu
44+
%End
45+
46+
void addFavorite();
47+
%Docstring
48+
Add current item to favorite
49+
%End
50+
void addFavoriteDirectory();
51+
%Docstring
52+
Add directory from file dialog to favorite
53+
%End
54+
void removeFavorite();
55+
%Docstring
56+
Remove from favorite
57+
%End
58+
59+
void refresh();
60+
%Docstring
61+
Refresh browser view model (and view)
62+
%End
63+
64+
void showFilterWidget( bool visible );
65+
%Docstring
66+
Show/hide filter widget
67+
%End
68+
void enablePropertiesWidget( bool enable );
69+
%Docstring
70+
Enable/disable properties widget
71+
%End
72+
void setFilterSyntax( QAction * );
73+
%Docstring
74+
Set filter syntax
75+
%End
76+
void setCaseSensitive( bool caseSensitive );
77+
%Docstring
78+
Set filter case sensitivity
79+
%End
80+
void setFilter();
81+
%Docstring
82+
Apply filter to the model
83+
%End
84+
void updateProjectHome();
85+
%Docstring
86+
Update project home directory
87+
%End
88+
89+
void addSelectedLayers();
90+
%Docstring
91+
Add selected layers to the project
92+
%End
93+
void showProperties();
94+
%Docstring
95+
Show the layer properties
96+
%End
97+
void hideItem();
98+
%Docstring
99+
Hide current item
100+
%End
101+
void toggleFastScan();
102+
%Docstring
103+
Toggle fast scan
104+
%End
105+
106+
void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
107+
%Docstring
108+
Selection hass changed
109+
%End
110+
void splitterMoved();
111+
%Docstring
112+
Splitter has been moved
113+
%End
114+
115+
signals:
116+
void openFile( const QString & );
117+
%Docstring
118+
Emitted when a file needs to be opened
119+
%End
120+
void handleDropUriList( const QgsMimeDataUtils::UriList & );
121+
%Docstring
122+
Emitted when drop uri list needs to be handled
123+
%End
124+
125+
protected:
126+
virtual void showEvent( QShowEvent *event );
127+
128+
%Docstring
129+
Show event override
130+
%End
131+
132+
};
133+
134+
135+
136+
/************************************************************************
137+
* This file has been generated automatically from *
138+
* *
139+
* src/gui/qgsbrowserdockwidget.h *
140+
* *
141+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
142+
************************************************************************/

‎src/app/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ SET(QGIS_APP_SRCS
1616
qgsattributetypedialog.cpp
1717
qgsattributetabledialog.cpp
1818
qgsbookmarks.cpp
19-
qgsbrowserdockwidget.cpp
2019
qgsclipboard.cpp
2120
qgscustomization.cpp
2221
qgscustomprojectiondialog.cpp
@@ -204,7 +203,6 @@ SET (QGIS_APP_MOC_HDRS
204203
qgsattributetypedialog.h
205204
qgsattributetabledialog.h
206205
qgsbookmarks.h
207-
qgsbrowserdockwidget.h
208206
qgsclipboard.h
209207
qgscustomization.h
210208
qgscustomprojectiondialog.h

‎src/app/qgisapp.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,11 +885,17 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
885885
mBrowserWidget->setObjectName( QStringLiteral( "Browser" ) );
886886
addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget );
887887
mBrowserWidget->hide();
888+
connect( this, &QgisApp::newProject, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );
889+
connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgisApp::openFile );
890+
connect( mBrowserWidget, &QgsBrowserDockWidget::handleDropUriList, this, &QgisApp::handleDropUriList );
888891

889892
mBrowserWidget2 = new QgsBrowserDockWidget( tr( "Browser Panel (2)" ), this );
890893
mBrowserWidget2->setObjectName( QStringLiteral( "Browser2" ) );
891894
addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget2 );
892895
mBrowserWidget2->hide();
896+
connect( this, &QgisApp::newProject, mBrowserWidget2, &QgsBrowserDockWidget::updateProjectHome );
897+
connect( mBrowserWidget2, &QgsBrowserDockWidget::openFile, this, &QgisApp::openFile );
898+
connect( mBrowserWidget2, &QgsBrowserDockWidget::handleDropUriList, this, &QgisApp::handleDropUriList );
893899

894900
addDockWidget( Qt::LeftDockWidgetArea, mAdvancedDigitizingDockWidget );
895901
mAdvancedDigitizingDockWidget->hide();

‎src/app/qgisapp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
232232
*/
233233
bool addProject( const QString &projectFile );
234234

235-
/** Convenience function to open either a project or a layer file.
236-
*/
237-
void openFile( const QString &fileName );
238235
//!Overloaded version of the private function with same name that takes the imagename as a parameter
239236
void saveMapAsImage( const QString &, QPixmap * );
240237

@@ -618,13 +615,16 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
618615
//! Unregister a previously registered custom drop handler.
619616
void unregisterCustomDropHandler( QgsCustomDropHandler *handler );
620617

618+
public slots:
621619
//! Process the list of URIs that have been dropped in QGIS
622620
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );
623621

624622
//! Returns the active map layer.
625623
QgsMapLayer *activeLayer();
626624

627625
public slots:
626+
//! Convenience function to open either a project or a layer file.
627+
void openFile( const QString &fileName );
628628
void layerTreeViewDoubleClicked( const QModelIndex &index );
629629
//! Make sure the insertion point for new layers is up-to-date with the current item in layer tree view
630630
void updateNewLayerInsertionPoint();

‎src/gui/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ SET(QGIS_GUI_SRCS
173173
qgsattributetypeloaddialog.cpp
174174
qgsblendmodecombobox.cpp
175175
qgsbrowsertreeview.cpp
176+
qgsbrowserdockwidget.cpp
177+
qgsbrowserdockwidget_p.cpp
176178
qgsbusyindicatordialog.cpp
177179
qgscharacterselectordialog.cpp
178180
qgscheckablecombobox.cpp
@@ -362,6 +364,8 @@ SET(QGIS_GUI_MOC_HDRS
362364
qgsdial.h
363365
qgsdialog.h
364366
qgsdockwidget.h
367+
qgsbrowserdockwidget_p.h
368+
qgsbrowserdockwidget.h
365369
qgsencodingfiledialog.h
366370
qgserrordialog.h
367371
qgsexpressionbuilderdialog.h
@@ -648,6 +652,8 @@ SET(QGIS_GUI_HDRS
648652
qgssqlcomposerdialog.h
649653
qgstablewidgetitem.h
650654
qgsuserinputdockwidget.h
655+
qgsbrowserdockwidget.h
656+
qgsbrowserdockwidget_p.h
651657
qgsvertexmarker.h
652658
qgsfiledownloader.h
653659

‎src/app/qgsbrowserdockwidget.cpp renamed to ‎src/gui/qgsbrowserdockwidget.cpp

Lines changed: 10 additions & 444 deletions
Large diffs are not rendered by default.

‎src/gui/qgsbrowserdockwidget.h

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/***************************************************************************
2+
qgsbrowserdockwidget.h
3+
---------------------
4+
begin : July 2011
5+
copyright : (C) 2011 by Martin Dobias
6+
email : wonder dot sk at gmail dot com
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
#ifndef QGSBROWSERDOCKWIDGET_H
16+
#define QGSBROWSERDOCKWIDGET_H
17+
18+
#include <ui_qgsbrowserdockwidgetbase.h>
19+
#include <ui_qgsbrowserlayerpropertiesbase.h>
20+
#include <ui_qgsbrowserdirectorypropertiesbase.h>
21+
#include <ui_qgsbrowserpropertiesdialogbase.h>
22+
23+
#include "qgsdataitem.h"
24+
#include "qgsbrowsertreeview.h"
25+
#include "qgsdockwidget.h"
26+
#include "qgsbrowserdockwidget_p.h"
27+
#include "qgis_gui.h"
28+
#include <QSortFilterProxyModel>
29+
30+
class QgsBrowserModel;
31+
class QModelIndex;
32+
class QgsDockBrowserTreeView;
33+
class QgsLayerItem;
34+
class QgsDataItem;
35+
class QgsBrowserTreeFilterProxyModel;
36+
37+
/**
38+
* \ingroup gui
39+
* The QgsBrowserDockWidget class
40+
* \since QGIS 3.0
41+
*/
42+
class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBrowserDockWidgetBase
43+
{
44+
Q_OBJECT
45+
public:
46+
47+
/**
48+
* Constructor for QgsBrowserDockWidget
49+
* \param name name of the widget
50+
* \param parent parent widget
51+
*/
52+
explicit QgsBrowserDockWidget( const QString &name, QWidget *parent SIP_TRANSFERTHIS = nullptr );
53+
~QgsBrowserDockWidget();
54+
//! Add directory to favorites
55+
void addFavoriteDirectory( const QString &favDir );
56+
57+
public slots:
58+
//! Add layer at index
59+
void addLayerAtIndex( const QModelIndex &index );
60+
//! Show context menu
61+
void showContextMenu( QPoint );
62+
63+
//! Add current item to favorite
64+
void addFavorite();
65+
//! Add directory from file dialog to favorite
66+
void addFavoriteDirectory();
67+
//! Remove from favorite
68+
void removeFavorite();
69+
70+
//! Refresh browser view model (and view)
71+
void refresh();
72+
73+
//! Show/hide filter widget
74+
void showFilterWidget( bool visible );
75+
//! Enable/disable properties widget
76+
void enablePropertiesWidget( bool enable );
77+
//! Set filter syntax
78+
void setFilterSyntax( QAction * );
79+
//! Set filter case sensitivity
80+
void setCaseSensitive( bool caseSensitive );
81+
//! Apply filter to the model
82+
void setFilter();
83+
//! Update project home directory
84+
void updateProjectHome();
85+
86+
//! Add selected layers to the project
87+
void addSelectedLayers();
88+
//! Show the layer properties
89+
void showProperties();
90+
//! Hide current item
91+
void hideItem();
92+
//! Toggle fast scan
93+
void toggleFastScan();
94+
95+
//! Selection hass changed
96+
void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
97+
//! Splitter has been moved
98+
void splitterMoved();
99+
100+
signals:
101+
//! Emitted when a file needs to be opened
102+
void openFile( const QString & );
103+
//! Emitted when drop uri list needs to be handled
104+
void handleDropUriList( const QgsMimeDataUtils::UriList & );
105+
106+
protected:
107+
//! Show event override
108+
void showEvent( QShowEvent *event ) override;
109+
110+
private:
111+
//! Refresh the model
112+
void refreshModel( const QModelIndex &index );
113+
//! Add a layer
114+
void addLayer( QgsLayerItem *layerItem );
115+
//! Clear the properties widget
116+
void clearPropertiesWidget();
117+
//! Set the properties widget
118+
void setPropertiesWidget();
119+
120+
//! Count selected items
121+
int selectedItemsCount();
122+
//! Settings prefix (the object name)
123+
QString settingsSection() { return objectName().toLower(); }
124+
125+
QgsDockBrowserTreeView *mBrowserView = nullptr;
126+
QgsBrowserModel *mModel = nullptr;
127+
QgsBrowserTreeFilterProxyModel *mProxyModel = nullptr;
128+
QString mInitPath;
129+
bool mPropertiesWidgetEnabled;
130+
// height fraction
131+
float mPropertiesWidgetHeight;
132+
133+
};
134+
135+
136+
137+
#endif // QGSBROWSERDOCKWIDGET_H

‎src/gui/qgsbrowserdockwidget_p.cpp

Lines changed: 483 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 109 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/***************************************************************************
2-
qgsbrowserdockwidget.h
2+
qgsbrowserdockwidget_p.h
3+
4+
Private classes for QgsBrowserDockWidget
5+
36
---------------------
4-
begin : July 2011
5-
copyright : (C) 2011 by Martin Dobias
6-
email : wonder dot sk at gmail dot com
7+
begin : May 2017
8+
copyright : (C) 2017 by Alessandro Pasotti
9+
real work done by : (C) 2011 by Martin Dobias
10+
email : a dot pasotti at itopen dot it
711
***************************************************************************
812
* *
913
* This program is free software; you can redistribute it and/or modify *
@@ -12,8 +16,22 @@
1216
* (at your option) any later version. *
1317
* *
1418
***************************************************************************/
15-
#ifndef QGSBROWSERDOCKWIDGET_H
16-
#define QGSBROWSERDOCKWIDGET_H
19+
20+
21+
#ifndef QGSBROWSERDOCKWIDGET_P_H
22+
#define QGSBROWSERDOCKWIDGET_P_H
23+
24+
/// @cond PRIVATE
25+
26+
//
27+
// W A R N I N G
28+
// -------------
29+
//
30+
// This file is not part of the QGIS API. It exists purely as an
31+
// implementation detail. This header file may change from version to
32+
// version without notice, or even be removed.
33+
//
34+
1735

1836
#include <ui_qgsbrowserdockwidgetbase.h>
1937
#include <ui_qgsbrowserlayerpropertiesbase.h>
@@ -24,7 +42,6 @@
2442
#include "qgsbrowsertreeview.h"
2543
#include "qgsdockwidget.h"
2644
#include <QSortFilterProxyModel>
27-
#include "qgis_app.h"
2845

2946
class QgsBrowserModel;
3047
class QModelIndex;
@@ -33,23 +50,41 @@ class QgsLayerItem;
3350
class QgsDataItem;
3451
class QgsBrowserTreeFilterProxyModel;
3552

36-
// hack to show wrapped text without spaces
53+
/**
54+
* Hack to show wrapped text without spaces
55+
*/
3756
class QgsBrowserPropertiesWrapLabel : public QTextEdit
3857
{
3958
Q_OBJECT
4059
public:
60+
61+
/**
62+
* Constructor for QgsBrowserPropertiesWrapLabel
63+
* \param text label text
64+
* \param parent parent widget
65+
*/
4166
QgsBrowserPropertiesWrapLabel( const QString &text, QWidget *parent = nullptr );
4267

4368
private slots:
4469
void adjustHeight( QSizeF size );
4570
};
4671

72+
/**
73+
* The QgsBrowserPropertiesWidget base class
74+
*/
4775
class QgsBrowserPropertiesWidget : public QWidget
4876
{
4977
Q_OBJECT
5078
public:
79+
80+
/**
81+
* Constructor for QgsBrowserPropertiesWidget
82+
* \param parent parent widget
83+
*/
5184
explicit QgsBrowserPropertiesWidget( QWidget *parent = nullptr );
85+
//! Factory method to create a new browser properties widget
5286
static QgsBrowserPropertiesWidget *createWidget( QgsDataItem *item, QWidget *parent = nullptr );
87+
//! Stub
5388
virtual void setItem( QgsDataItem *item ) { Q_UNUSED( item ) }
5489
//! Set content widget, usually item paramWidget. Takes ownership.
5590
virtual void setWidget( QWidget *widget );
@@ -62,137 +97,128 @@ class QgsBrowserPropertiesWidget : public QWidget
6297
virtual void setCondensedMode( bool condensedMode ) { Q_UNUSED( condensedMode ); }
6398
};
6499

100+
/**
101+
* The QgsBrowserLayerProperties class
102+
*/
65103
class QgsBrowserLayerProperties : public QgsBrowserPropertiesWidget, private Ui::QgsBrowserLayerPropertiesBase
66104
{
67105
Q_OBJECT
68106
public:
107+
108+
/**
109+
* Constructor for QgsBrowserLayerProperties
110+
* \param parent parent widget
111+
*/
69112
explicit QgsBrowserLayerProperties( QWidget *parent = nullptr );
113+
//! Set item
70114
void setItem( QgsDataItem *item ) override;
71115

116+
/** Sets whether the properties widget should display in condensed mode, ie, for display in a dock
117+
* widget rather than it's own separate dialog.
118+
* \param condensedMode set to true to enable condensed mode
119+
* \since QGIS 2.10
120+
*/
72121
virtual void setCondensedMode( bool condensedMode ) override;
73122

74123
private:
75124
QgsBrowserPropertiesWrapLabel *mUriLabel = nullptr;
76125
};
77126

127+
/**
128+
* The QgsBrowserDirectoryProperties class
129+
*/
78130
class QgsBrowserDirectoryProperties : public QgsBrowserPropertiesWidget, private Ui::QgsBrowserDirectoryPropertiesBase
79131
{
80132
Q_OBJECT
81133
public:
134+
135+
/**
136+
* Constructor for QgsBrowserDirectoryProperties
137+
* \param parent parent widget
138+
*/
82139
explicit QgsBrowserDirectoryProperties( QWidget *parent = nullptr );
83140

141+
//! Create widget from the given item and add it
84142
void setItem( QgsDataItem *item ) override;
85143
private:
86144
QgsDirectoryParamWidget *mDirectoryWidget = nullptr;
87145
QgsBrowserPropertiesWrapLabel *mPathLabel = nullptr;
88146
};
89147

148+
/**
149+
* The QgsBrowserPropertiesDialog class
150+
*/
90151
class QgsBrowserPropertiesDialog : public QDialog, private Ui::QgsBrowserPropertiesDialogBase
91152
{
92153
Q_OBJECT
93154
public:
155+
156+
/**
157+
* Constructor for QgsBrowserPropertiesDialog
158+
* \param settingsSection prefix for settings (from the object name)
159+
* \param parent parent widget
160+
*/
94161
QgsBrowserPropertiesDialog( const QString &settingsSection, QWidget *parent = nullptr );
95162
~QgsBrowserPropertiesDialog();
96163

164+
//! Create dialog from the given item and add it
97165
void setItem( QgsDataItem *item );
98166

99167
private:
100168
QgsBrowserPropertiesWidget *mPropertiesWidget = nullptr;
101169
QString mSettingsSection;
102170
};
103171

104-
class APP_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBrowserDockWidgetBase
105-
{
106-
Q_OBJECT
107-
public:
108-
explicit QgsBrowserDockWidget( const QString &name, QWidget *parent = nullptr );
109-
~QgsBrowserDockWidget();
110-
void addFavoriteDirectory( const QString &favDir );
111-
112-
public slots:
113-
void addLayerAtIndex( const QModelIndex &index );
114-
void showContextMenu( QPoint );
115-
116-
void addFavorite();
117-
void addFavoriteDirectory();
118-
void removeFavorite();
119-
120-
void refresh();
121-
122-
void showFilterWidget( bool visible );
123-
void enablePropertiesWidget( bool enable );
124-
void setFilterSyntax( QAction * );
125-
void setCaseSensitive( bool caseSensitive );
126-
void setFilter();
127-
128-
// layer menu items
129-
void addSelectedLayers();
130-
void showProperties();
131-
void hideItem();
132-
void toggleFastScan();
133-
134-
void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
135-
void splitterMoved();
136-
137-
protected:
138-
void refreshModel( const QModelIndex &index );
139-
void showEvent( QShowEvent *event ) override;
140-
void addLayer( QgsLayerItem *layerItem );
141-
void clearPropertiesWidget();
142-
void setPropertiesWidget();
143-
144-
int selectedItemsCount();
145-
QString settingsSection() { return objectName().toLower(); }
146-
147-
QgsDockBrowserTreeView *mBrowserView = nullptr;
148-
QgsBrowserModel *mModel = nullptr;
149-
QgsBrowserTreeFilterProxyModel *mProxyModel = nullptr;
150-
QString mInitPath;
151-
bool mPropertiesWidgetEnabled;
152-
// height fraction
153-
float mPropertiesWidgetHeight;
154-
155-
private:
156-
};
157-
158172

159173
/**
160-
Utility class for correct drag&drop handling.
161-
162-
We want to allow user to drag layers to qgis window. At the same time we do not
163-
accept drops of the items on our view - but if we ignore the drag enter action
164-
then qgis application consumes the drag events and it is possible to drop the
165-
items on the tree view although the drop is actually managed by qgis app.
174+
* Utility class for correct drag&drop handling.
175+
*
176+
* We want to allow user to drag layers to qgis window. At the same time we do not
177+
* accept drops of the items on our view - but if we ignore the drag enter action
178+
* then qgis application consumes the drag events and it is possible to drop the
179+
* items on the tree view although the drop is actually managed by qgis app.
166180
*/
167181
class QgsDockBrowserTreeView : public QgsBrowserTreeView
168182
{
169183
Q_OBJECT
170184

171185
public:
172-
explicit QgsDockBrowserTreeView( QWidget *parent );
173186

187+
/**
188+
* Constructor for QgsDockBrowserTreeView
189+
* \param parent parent widget
190+
*/
191+
explicit QgsDockBrowserTreeView( QWidget *parent );
192+
//! Overrides drag enter event
174193
void dragEnterEvent( QDragEnterEvent *e ) override;
194+
//! Overrides drag move event
175195
void dragMoveEvent( QDragMoveEvent *e ) override;
196+
//! Overrides drag stop event
176197
void dropEvent( QDropEvent *e ) override;
177198
};
178199

179200
/**
180-
Utility class for filtering browser items
201+
* Utility class for filtering browser items
181202
*/
182203
class QgsBrowserTreeFilterProxyModel : public QSortFilterProxyModel
183204
{
184205
Q_OBJECT
185206
public:
186-
explicit QgsBrowserTreeFilterProxyModel( QObject *parent );
187207

208+
/**
209+
* Constructor for QgsBrowserTreeFilterProxyModel
210+
* @param parent parent widget
211+
*/
212+
explicit QgsBrowserTreeFilterProxyModel( QObject *parent );
213+
//! Set the browser model
188214
void setBrowserModel( QgsBrowserModel *model );
189-
215+
//! Set the filter syntax
190216
void setFilterSyntax( const QString &syntax );
191-
217+
//! Set the filter
192218
void setFilter( const QString &filter );
193-
219+
//! Set case sensitivity
194220
void setCaseSensitive( bool caseSensitive );
195-
221+
//! Update filter
196222
void updateFilter();
197223

198224
protected:
@@ -203,20 +229,23 @@ class QgsBrowserTreeFilterProxyModel : public QSortFilterProxyModel
203229
QString mPatternSyntax;
204230
Qt::CaseSensitivity mCaseSensitivity;
205231

232+
//! Filter accepts string
206233
bool filterAcceptsString( const QString &value ) const;
207234

208-
// It would be better to apply the filer only to expanded (visible) items, but using mapFromSource() + view here was causing strange errors
235+
//! It would be better to apply the filer only to expanded (visible) items, but using mapFromSource() + view here was causing strange errors
209236
bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
210237

211-
// returns true if at least one ancestor is accepted by filter
238+
//! Returns true if at least one ancestor is accepted by filter
212239
bool filterAcceptsAncestor( const QModelIndex &sourceIndex ) const;
213240

214-
// returns true if at least one descendant s accepted by filter
241+
//! Returns true if at least one descendant s accepted by filter
215242
bool filterAcceptsDescendant( const QModelIndex &sourceIndex ) const;
216243

217-
// filter accepts item name
244+
//! Filter accepts item name
218245
bool filterAcceptsItem( const QModelIndex &sourceIndex ) const;
219246
};
220247

221248

222-
#endif // QGSBROWSERDOCKWIDGET_H
249+
/// @endcond
250+
251+
#endif // QGSBROWSERDOCKWIDGET_P_H

0 commit comments

Comments
 (0)
Please sign in to comment.