QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 
35 class 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 ) { mIcon = icon; emit changed(); }
46 
48  QString toolTip() const { return mToolTip; }
50  void setToolTip( const QString &tip ) { mToolTip = tip; }
51 
52  signals:
54  void clicked( const QModelIndex &index );
55 
60  void changed();
61 
62  private:
63  QIcon mIcon;
64  QString mToolTip;
65 };
66 
67 #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