-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsprocessingtoolboxtreeview.h
117 lines (95 loc) · 3.94 KB
/
qgsprocessingtoolboxtreeview.h
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
/***************************************************************************
qgsprocessingtoolboxtreeview.h
-----------------------------
begin : July 2018
copyright : (C) 2018 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPROCESSINGTOOLBOXTREEVIEW_H
#define QGSPROCESSINGTOOLBOXTREEVIEW_H
#include "qgis.h"
#include "qgis_gui.h"
#include <QTreeView>
#include "qgsprocessingtoolboxmodel.h"
class QgsProcessingRegistry;
class QgsProcessingRecentAlgorithmLog;
class QgsProcessingAlgorithm;
///@cond PRIVATE
/**
* Processing toolbox tree view, showing algorithms and providers in a tree structure.
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
*/
class GUI_EXPORT QgsProcessingToolboxTreeView : public QTreeView
{
Q_OBJECT
public:
/**
* Constructor for QgsProcessingToolboxTreeView, with the specified \a parent widget.
*
* If \a registry is set, then the view will automatically be populated with algorithms
* and providers from the registry. Otherwise, users must manually call setRegistry()
* to associate a registry with the view.
*
* If \a recentLog is specified then it will be used to create a "Recently used" top
* level group containing recently used algorithms.
*/
QgsProcessingToolboxTreeView( QWidget *parent SIP_TRANSFERTHIS = nullptr,
QgsProcessingRegistry *registry = nullptr,
QgsProcessingRecentAlgorithmLog *recentLog = nullptr );
/**
* Sets the processing \a registry associated with the view.
*
* If \a recentLog is specified then it will be used to create a "Recently used" top
* level group containing recently used algorithms.
*/
void setRegistry(
QgsProcessingRegistry *registry,
QgsProcessingRecentAlgorithmLog *recentLog = nullptr );
/**
* Sets the toolbox proxy model used to drive the view.
*/
void setToolboxProxyModel( QgsProcessingToolboxProxyModel *model SIP_TRANSFER );
/**
* Returns the algorithm at the specified tree view \a index, or a nullptr
* if the index does not correspond to an algorithm.
*/
const QgsProcessingAlgorithm *algorithmForIndex( const QModelIndex &index );
/**
* Returns the currently selected algorithm in the tree view, or a nullptr
* if no algorithm is currently selected.
*/
const QgsProcessingAlgorithm *selectedAlgorithm();
/**
* Sets \a filters controlling the view's contents.
*/
void setFilters( QgsProcessingToolboxProxyModel::Filters filters );
/**
* Sets the vector \a layer for the in-place algorithms
*/
void setInPlaceLayer( QgsVectorLayer *layer );
public slots:
/**
* Sets a \a filter string, used to filter out the contents of the view
* to matching algorithms.
*/
void setFilterString( const QString &filter );
private:
QgsProcessingToolboxProxyModel *mModel = nullptr;
QgsProcessingToolboxModel *mToolboxModel = nullptr;
/**
* Returns the first visible algorithm in the tree.
*/
QModelIndex findFirstVisibleAlgorithm( const QModelIndex &parent );
friend class TestQgsProcessingModel;
};
///@endcond
#endif // QGSPROCESSINGTOOLBOXTREEVIEW_H