QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgslayoutguidewidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutguidewidget.h
3  ----------------------
4  begin : July 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSLAYOUTGUIDEWIDGET_H
18 #define QGSLAYOUTGUIDEWIDGET_H
19 
20 // We don't want to expose this in the public API
21 #define SIP_NO_FILE
22 
23 #include "qgis_gui.h"
24 #include "ui_qgslayoutguidewidgetbase.h"
25 #include "qgspanelwidget.h"
26 #include <QStyledItemDelegate>
27 
28 
29 class QgsLayoutView;
30 class QgsLayout;
32 
40 class GUI_EXPORT QgsLayoutGuideWidget: public QgsPanelWidget, private Ui::QgsLayoutGuideWidgetBase
41 {
42  Q_OBJECT
43  public:
45  QgsLayoutGuideWidget( QWidget *parent, QgsLayout *layout, QgsLayoutView *layoutView );
46 
47  public slots:
48 
52  void setCurrentPage( int page );
53 
54  private slots:
55 
56  void addHorizontalGuide();
57  void addVerticalGuide();
58 
59  void deleteHorizontalGuide();
60  void deleteVerticalGuide();
61 
62  void clearAll();
63 
64  void applyToAll();
65 
66  void updatePageCount();
67 
68  private:
69 
70  QgsLayout *mLayout = nullptr;
71  QgsLayoutGuideProxyModel *mHozProxyModel = nullptr;
72  QgsLayoutGuideProxyModel *mVertProxyModel = nullptr;
73  int mPage = 0;
74 
75 };
76 
84 class GUI_EXPORT QgsLayoutGuidePositionDelegate : public QStyledItemDelegate
85 {
86  Q_OBJECT
87 
88  public:
89 
91  QgsLayoutGuidePositionDelegate( QObject *parent );
92 
93  protected:
94  QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &index ) const override;
95  void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
96 
97 };
98 
106 class GUI_EXPORT QgsLayoutGuideUnitDelegate : public QStyledItemDelegate
107 {
108  Q_OBJECT
109 
110  public:
111 
113  QgsLayoutGuideUnitDelegate( QObject *parent );
114 
115  protected:
116  QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &index ) const override;
117  void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
118 
119 };
120 
121 #endif // QGSLAYOUTGUIDEWIDGET_H
View delegate displaying a QgsDoubleSpinBox for the layout guide position.
Filters QgsLayoutGuideCollection models to guides of a single orientation (horizontal or vertical).
View delegate displaying a QgsLayoutUnitsComboBox for the layout guide unit.
Widget for managing the layout guides.
A graphical widget to display and interact with QgsLayouts.
Definition: qgslayoutview.h:50
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:51
Base class for any widget that can be shown as a inline panel.