QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
layertree
qgscustomlayerorderwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgscustomlayerorderwidget.h
3
--------------------------------------
4
Date : May 2014
5
Copyright : (C) 2014 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
16
#ifndef QGSCUSTOMLAYERORDERWIDGET_H
17
#define QGSCUSTOMLAYERORDERWIDGET_H
18
19
#include "
qgis.h
"
20
#include "qgis_gui.h"
21
22
#include <QAbstractListModel>
23
#include <QWidget>
24
25
class
CustomLayerOrderModel;
26
class
QgsLayerTreeMapCanvasBridge
;
27
class
QgsLayerTreeNode
;
28
class
QgsMapLayer
;
29
30
class
QCheckBox;
31
class
QListView;
32
44
class
GUI_EXPORT
QgsCustomLayerOrderWidget
:
public
QWidget
45
{
46
Q_OBJECT
47
public
:
49
explicit
QgsCustomLayerOrderWidget
(
QgsLayerTreeMapCanvasBridge
*bridge, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
50
51
signals:
52
53
private
slots:
54
void
bridgeHasCustomLayerOrderChanged(
bool
state );
55
void
bridgeCustomLayerOrderChanged();
57
void
nodeVisibilityChanged(
QgsLayerTreeNode
*node );
58
59
void
modelUpdated();
60
61
private
:
62
QgsLayerTreeMapCanvasBridge
*mBridge =
nullptr
;
63
64
QCheckBox *mChkOverride =
nullptr
;
65
CustomLayerOrderModel *mModel =
nullptr
;
66
QListView *mView =
nullptr
;
67
};
68
69
70
#ifndef SIP_RUN
72
class
CustomLayerOrderModel :
public
QAbstractListModel
73
{
74
Q_OBJECT
75
76
public
:
77
CustomLayerOrderModel(
QgsLayerTreeMapCanvasBridge
*bridge, QObject *parent =
nullptr
);
78
79
int
rowCount(
const
QModelIndex & )
const override
;
80
81
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
82
83
bool
setData(
const
QModelIndex &index,
const
QVariant &value,
int
role )
override
;
84
85
Qt::ItemFlags flags(
const
QModelIndex &index )
const override
;
86
87
Qt::DropActions supportedDropActions()
const override
;
88
89
QStringList mimeTypes()
const override
;
90
91
QMimeData *mimeData(
const
QModelIndexList &indexes )
const override
;
92
93
bool
dropMimeData(
const
QMimeData *data, Qt::DropAction action,
int
row,
int
column,
const
QModelIndex &parent )
override
;
94
95
bool
removeRows(
int
row,
int
count,
const
QModelIndex &parent )
override
;
96
97
void
refreshModel(
const
QList<QgsMapLayer *> &order );
98
99
QStringList order()
const
{
return
mOrder; }
100
101
void
updateLayerVisibility(
const
QString &layerId );
102
103
protected
:
104
QgsLayerTreeMapCanvasBridge *mBridge =
nullptr
;
105
QStringList mOrder;
106
};
108
#endif
109
110
#endif
// QGSCUSTOMLAYERORDERWIDGET_H
QgsCustomLayerOrderWidget::QgsCustomLayerOrderWidget
QgsCustomLayerOrderWidget(QgsLayerTreeMapCanvasBridge *bridge, QWidget *parent=nullptr)
Constructor for QgsCustomLayerOrderWidget.
Definition
qgscustomlayerorderwidget.cpp:33
QgsLayerTreeMapCanvasBridge
Takes care of updates of layer sets for a QgsMapCanvas from a layer tree.
Definition
qgslayertreemapcanvasbridge.h:48
QgsLayerTreeNode
Base class for nodes in a layer tree.
Definition
qgslayertreenode.h:81
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:83
qgis.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
Generated on
for QGIS API Documentation by
1.17.0