QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgslayoutitemslistview.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitemslistview.h
3 ------------------------
4 Date : October 2017
5 Copyright : (C) 2017 Nyall Dawson
6 Email : nyall dot dawson 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 QGSLAYOUTITEMSLISTVIEW_H
17#define QGSLAYOUTITEMSLISTVIEW_H
18
19// We don't want to expose this in the public API
20#define SIP_NO_FILE
21
22#include "qgis_gui.h"
23#include "qgis_sip.h"
24#include <QTreeView>
25#include <QSortFilterProxyModel>
26
27class QgsLayout;
29class QgsLayoutModel;
30class QgsLayoutItem;
31
40class GUI_EXPORT QgsLayoutItemsListViewModel : public QSortFilterProxyModel
41{
42 Q_OBJECT
43
44 public:
46 QgsLayoutItemsListViewModel( QgsLayoutModel *model, QObject *parent );
47
49 QgsLayoutItem *itemFromIndex( const QModelIndex &index ) const;
50 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
51
52 public slots:
54 void setSelected( const QModelIndex &index );
55
56 protected:
57 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
58
59 private:
60 QgsLayoutModel *mModel = nullptr;
61};
62
70class GUI_EXPORT QgsLayoutItemsListView : public QTreeView
71{
72 Q_OBJECT
73
74 public:
75
79 QgsLayoutItemsListView( QWidget *parent, QgsLayoutDesignerInterface *designer );
80
82 void setCurrentLayout( QgsLayout *layout );
83
84 private slots:
85
86 void showContextMenu( QPoint point );
87
88 private:
89
90 QgsLayout *mLayout = nullptr;
91 QgsLayoutItemsListViewModel *mModel = nullptr;
92 QgsLayoutDesignerInterface *mDesigner = nullptr;
93};
94
95#endif // QGSLAYOUTITEMSLISTVIEW_H
A common interface for layout designer dialogs and widgets.
Base class for graphical items within a QgsLayout.
Model for the layout items list view.
A list view for showing items in a layout.
A model for items attached to a layout.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50