QGIS API Documentation 3.99.0-Master (a5475b57e34)
Loading...
Searching...
No Matches
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
22#include "ui_qgslayoutguidewidgetbase.h"
23
24#include "qgis_gui.h"
25#include "qgspanelwidget.h"
26
27#include <QStyledItemDelegate>
28
29#define SIP_NO_FILE
30
31class QgsLayoutView;
32class QgsLayout;
34
42class GUI_EXPORT QgsLayoutGuideWidget : public QgsPanelWidget, private Ui::QgsLayoutGuideWidgetBase
43{
44 Q_OBJECT
45 public:
47 QgsLayoutGuideWidget( QWidget *parent, QgsLayout *layout, QgsLayoutView *layoutView );
48
49 public slots:
50
54 void setCurrentPage( int page );
55
56 private slots:
57
58 void addHorizontalGuide();
59 void addVerticalGuide();
60
61 void deleteHorizontalGuide();
62 void deleteVerticalGuide();
63
64 void clearAll();
65
66 void applyToAll();
67
68 void updatePageCount();
69
70 private:
71 QgsLayout *mLayout = nullptr;
72 QgsLayoutGuideProxyModel *mHozProxyModel = nullptr;
73 QgsLayoutGuideProxyModel *mVertProxyModel = nullptr;
74 int mPage = 0;
75};
76
84class GUI_EXPORT QgsLayoutGuidePositionDelegate : public QStyledItemDelegate
85{
86 Q_OBJECT
87
88 public:
90 QgsLayoutGuidePositionDelegate( QObject *parent );
91
92 protected:
93 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &index ) const override;
94 void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
95};
96
104class GUI_EXPORT QgsLayoutGuideUnitDelegate : public QStyledItemDelegate
105{
106 Q_OBJECT
107
108 public:
110 QgsLayoutGuideUnitDelegate( QObject *parent );
111
112 protected:
113 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &index ) const override;
114 void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
115};
116
117#endif // QGSLAYOUTGUIDEWIDGET_H
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const override
QgsLayoutGuidePositionDelegate(QObject *parent)
constructor
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Filters QgsLayoutGuideCollection models to guides of a single orientation (horizontal or vertical).
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
QgsLayoutGuideUnitDelegate(QObject *parent)
constructor
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const override
QgsLayoutGuideWidget(QWidget *parent, QgsLayout *layout, QgsLayoutView *layoutView)
constructor
void setCurrentPage(int page)
Sets the current page number to manage the guides for.
A graphical widget to display and interact with QgsLayouts.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition qgslayout.h:50
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.