QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgslayertreeviewitemdelegate.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayertreeviewitemdelegate.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 QGSLAYERTREEVIEWITEMDELEGATE_H
17#define QGSLAYERTREEVIEWITEMDELEGATE_H
18
19#include "qgis_sip.h"
20
22
24
25//
26// W A R N I N G
27// -------------
28//
29// This file is not part of the QGIS API. It exists purely as an
30// implementation detail. This header file may change from version to
31// version without notice, or even be removed.
32//
33
35
36#include "qgsproxystyle.h"
37#include <QStyledItemDelegate>
38
42class QgsLayerTreeViewProxyStyle : public QgsProxyStyle
43{
44 Q_OBJECT
45
46 public:
47 explicit QgsLayerTreeViewProxyStyle( QgsLayerTreeView *treeView );
48
49 QRect subElementRect( SubElement element, const QStyleOption *option, const QWidget *widget ) const override;
50
51 static const auto SE_LayerTreeItemIndicator = SE_CustomBase + 1;
52
53 private:
54 QgsLayerTreeView *mLayerTreeView;
55};
56
57
61class QgsLayerTreeViewItemDelegate : public QStyledItemDelegate
62{
63 Q_OBJECT
64 public:
65 explicit QgsLayerTreeViewItemDelegate( QgsLayerTreeView *parent );
66
67 void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
68
69 bool helpEvent( QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index ) override;
70
71 private slots:
72 void onClicked( const QModelIndex &index );
73
74 private:
75 QgsLayerTreeView *mLayerTreeView;
76};
77
79
80#endif // QGSLAYERTREEVIEWITEMDELEGATE_H
The QgsLayerTreeView class extends QTreeView and provides some additional functionality when working ...
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style,...
#define SIP_NO_FILE