QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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#define SIP_NO_FILE
22
23#include "ui_qgslayoutguidewidgetbase.h"
24
25#include "qgis_gui.h"
26#include "qgspanelwidget.h"
27
28#include <QStyledItemDelegate>
29
30class QgsLayoutView;
31class QgsLayout;
33
41class GUI_EXPORT QgsLayoutGuideWidget : public QgsPanelWidget, private Ui::QgsLayoutGuideWidgetBase
42{
43 Q_OBJECT
44 public:
46 QgsLayoutGuideWidget( QWidget *parent, QgsLayout *layout, QgsLayoutView *layoutView );
47
48 public slots:
49
53 void setCurrentPage( int page );
54
55 private slots:
56
57 void addHorizontalGuide();
58 void addVerticalGuide();
59
60 void deleteHorizontalGuide();
61 void deleteVerticalGuide();
62
63 void clearAll();
64
65 void applyToAll();
66
67 void updatePageCount();
68
69 private:
70 QgsLayout *mLayout = nullptr;
71 QgsLayoutGuideProxyModel *mHozProxyModel = nullptr;
72 QgsLayoutGuideProxyModel *mVertProxyModel = nullptr;
73 int mPage = 0;
74};
75
83class GUI_EXPORT QgsLayoutGuidePositionDelegate : public QStyledItemDelegate
84{
85 Q_OBJECT
86
87 public:
89 QgsLayoutGuidePositionDelegate( QObject *parent );
90
91 protected:
92 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &index ) const override;
93 void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
94};
95
103class GUI_EXPORT QgsLayoutGuideUnitDelegate : public QStyledItemDelegate
104{
105 Q_OBJECT
106
107 public:
109 QgsLayoutGuideUnitDelegate( QObject *parent );
110
111 protected:
112 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &index ) const override;
113 void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
114};
115
116#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.