QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgslayertreeviewindicator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayertreeviewindicator.h
3 --------------------------------------
4 Date : January 2018
5 Copyright : (C) 2018 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 QGSLAYERTREEVIEWINDICATOR_H
17#define QGSLAYERTREEVIEWINDICATOR_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21
22#include <QIcon>
23#include <QObject>
24
35class GUI_EXPORT QgsLayerTreeViewIndicator : public QObject
36{
37 Q_OBJECT
38 public:
40 explicit QgsLayerTreeViewIndicator( QObject *parent SIP_TRANSFERTHIS = nullptr );
41
43 QIcon icon() const { return mIcon; }
45 void setIcon( const QIcon &icon )
46 {
47 mIcon = icon;
48 emit changed();
49 }
50
52 QString toolTip() const { return mToolTip; }
54 void setToolTip( const QString &tip ) { mToolTip = tip; }
55
56 signals:
58 void clicked( const QModelIndex &index );
59
64 void changed();
65
66 private:
67 QIcon mIcon;
68 QString mToolTip;
69};
70
71#endif // QGSLAYERTREEVIEWINDICATOR_H
Indicator that can be used in a layer tree view to display icons next to items of the layer tree.
QString toolTip() const
Returns tool tip text that will be shown when user hovers mouse over the indicator.
QIcon icon() const
Indicator icon that will be displayed in the layer tree view.
void changed()
Emitted when the indicator changes state (e.g.
void clicked(const QModelIndex &index)
Emitted when user clicks on the indicator.
void setToolTip(const QString &tip)
Sets tool tip text.
void setIcon(const QIcon &icon)
Sets indicator icon that will be displayed in the layer tree view.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53