QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
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;
51 QModelIndex indexForItem( QgsLayoutItem *item, const int column = 0 ) const;
52 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
53
54 public slots:
56 void setSelected( const QModelIndex &index );
57
58 protected:
59 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
60
61 private:
62 QgsLayoutModel *mModel = nullptr;
63};
64
72class GUI_EXPORT QgsLayoutItemsListView : public QTreeView
73{
74 Q_OBJECT
75
76 public:
77
81 QgsLayoutItemsListView( QWidget *parent, QgsLayoutDesignerInterface *designer );
82
84 void setCurrentLayout( QgsLayout *layout );
85
86 private slots:
87
88 void showContextMenu( QPoint point );
89
91 void updateSelection();
93 void onItemFocused( QgsLayoutItem *focusedItem );
94
95 private:
96
97 QgsLayout *mLayout = nullptr;
98 QgsLayoutItemsListViewModel *mModel = nullptr;
99 QgsLayoutDesignerInterface *mDesigner = nullptr;
100
101 bool mUpdatingSelection = false;
102 bool mUpdatingFromView = false;
103};
104
105#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