Skip to content

Commit 70fe622

Browse files
committed
Add iface.layerTreeCanvasBridge()
1 parent 4984cae commit 70fe622

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

python/gui/qgisinterface.sip

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ class QgisInterface : QObject
159159
/** Return a pointer to the map canvas */
160160
virtual QgsMapCanvas * mapCanvas() = 0;
161161

162+
/** Returns a pointer to the layer tree canvas bridge */
163+
virtual QgsLayerTreeMapCanvasBridge* layerTreeCanvasBridge() = 0;
164+
162165
/** Return a pointer to the main window (instance of QgisApp in case of QGIS) */
163166
virtual QWidget * mainWindow() = 0;
164167

src/app/qgisappinterface.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ QgsMapCanvas * QgisAppInterface::mapCanvas()
311311
return qgis->mapCanvas();
312312
}
313313

314+
QgsLayerTreeMapCanvasBridge* QgisAppInterface::layerTreeCanvasBridge()
315+
{
316+
return qgis->layerTreeCanvasBridge();
317+
}
318+
314319
QWidget * QgisAppInterface::mainWindow()
315320
{
316321
return qgis;

src/app/qgisappinterface.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
168168
/** Return a pointer to the map canvas used by qgisapp */
169169
QgsMapCanvas * mapCanvas() override;
170170

171+
/**
172+
* Returns a pointer to the layer tree canvas bridge
173+
*
174+
* @note added in 2.12
175+
*/
176+
QgsLayerTreeMapCanvasBridge* layerTreeCanvasBridge() override;
177+
171178
/** Gives access to main QgisApp object
172179
173180
Plugins don't need to know about QgisApp, as we pass it as QWidget,
@@ -243,7 +250,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
243250

244251
/** Add "add layer" action to the layer menu */
245252
void insertAddLayerAction( QAction *action ) override;
246-
/** remove "add layer" action from the layer menu */
253+
/** Remove "add layer" action from the layer menu */
247254
void removeAddLayerAction( QAction *action ) override;
248255

249256
/** Add a dock widget to the main window */
@@ -252,12 +259,12 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
252259
/** Remove specified dock widget from main window (doesn't delete it). */
253260
void removeDockWidget( QDockWidget * dockwidget ) override;
254261

255-
/** show layer properties dialog for layer
262+
/** Show layer properties dialog for layer
256263
* @param l layer to show properties table for
257264
*/
258265
virtual void showLayerProperties( QgsMapLayer *l ) override;
259266

260-
/** show layer attribute dialog for layer
267+
/** Show layer attribute dialog for layer
261268
* @param l layer to show attribute table for
262269
*/
263270
virtual void showAttributeTable( QgsVectorLayer *l ) override;

src/gui/qgisinterface.h

+13-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class QWidget;
2828
class QgsAttributeDialog;
2929
class QgsComposerView;
3030
class QgsFeature;
31+
class QgsLayerTreeMapCanvasBridge;
3132
class QgsLayerTreeView;
3233
class QgsLegendInterface;
3334
class QgsMapCanvas;
@@ -205,6 +206,13 @@ class GUI_EXPORT QgisInterface : public QObject
205206
/** Return a pointer to the map canvas */
206207
virtual QgsMapCanvas * mapCanvas() = 0;
207208

209+
/**
210+
* Returns a pointer to the layer tree canvas bridge
211+
*
212+
* @note added in 2.12
213+
*/
214+
virtual QgsLayerTreeMapCanvasBridge* layerTreeCanvasBridge() = 0;
215+
208216
/** Return a pointer to the main window (instance of QgisApp in case of QGIS) */
209217
virtual QWidget * mainWindow() = 0;
210218

@@ -291,10 +299,10 @@ class GUI_EXPORT QgisInterface : public QObject
291299
/** Remove specified dock widget from main window (doesn't delete it). */
292300
virtual void removeDockWidget( QDockWidget * dockwidget ) = 0;
293301

294-
/** open layer properties dialog */
302+
/** Open layer properties dialog */
295303
virtual void showLayerProperties( QgsMapLayer *l ) = 0;
296304

297-
/** open attribute table dialog */
305+
/** Open attribute table dialog */
298306
virtual void showAttributeTable( QgsVectorLayer *l ) = 0;
299307

300308
/** Add window to Window menu. The action title is the window title
@@ -568,14 +576,14 @@ class GUI_EXPORT QgisInterface : public QObject
568576
* This signal is emitted when the initialization is complete
569577
*/
570578
void initializationCompleted();
571-
/** emitted when a project file is successfully read
579+
/** Emitted when a project file is successfully read
572580
@note
573581
This is useful for plug-ins that store properties with project files. A
574582
plug-in can connect to this signal. When it is emitted, the plug-in
575583
knows to then check the project properties for any relevant state.
576584
*/
577585
void projectRead();
578-
/** emitted when starting an entirely new project
586+
/** Emitted when starting an entirely new project
579587
@note
580588
This is similar to projectRead(); plug-ins might want to be notified
581589
that they're in a new project. Yes, projectRead() could have been
@@ -585,7 +593,7 @@ class GUI_EXPORT QgisInterface : public QObject
585593
*/
586594
void newProjectCreated();
587595

588-
/**This signal is emitted when a layer has been saved using save as
596+
/** This signal is emitted when a layer has been saved using save as
589597
@note
590598
added in version 2.7
591599
*/

0 commit comments

Comments
 (0)