QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
qgslayoutpicturewidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutpicturewidget.h
3  --------------------------
4  begin : October 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSLAYOUTPICTUREWIDGET_H
19 #define QGSLAYOUTPICTUREWIDGET_H
20 
21 // We don't want to expose this in the public API
22 #define SIP_NO_FILE
23 
24 #include "qgis_gui.h"
25 #include "ui_qgslayoutpicturewidgetbase.h"
26 #include "qgslayoutitemwidget.h"
27 
29 
37 class GUI_EXPORT QgsLayoutPictureWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayoutPictureWidgetBase
38 {
39  Q_OBJECT
40 
41  public:
43  explicit QgsLayoutPictureWidget( QgsLayoutItemPicture *picture );
44  void setMasterLayout( QgsMasterLayoutInterface *masterLayout ) override;
45 
46  private slots:
47  void mPictureRotationSpinBox_valueChanged( double d );
48  void mRotationFromComposerMapCheckBox_stateChanged( int state );
49  void mapChanged( QgsLayoutItem *item );
50  void mResizeModeComboBox_currentIndexChanged( int index );
51  void mAnchorPointComboBox_currentIndexChanged( int index );
52 
53  protected:
54 
55  bool setNewItem( QgsLayoutItem *item ) override;
56 
57  protected slots:
59  void populateDataDefinedButtons();
60 
61  private slots:
63  void setGuiElementValues();
64 
66  void setPicRotationSpinValue( double r );
67 
68  void mFillColorButton_colorChanged( const QColor &color );
69  void mStrokeColorButton_colorChanged( const QColor &color );
70  void mStrokeWidthSpinBox_valueChanged( double d );
71  void mPictureRotationOffsetSpinBox_valueChanged( double d );
72  void mNorthTypeComboBox_currentIndexChanged( int index );
73  void modeChanged();
74  void updatePictureTypeWidgets();
75 
76  void populateList();
77  void populateIcons( const QModelIndex &idx );
78  void setSvgName( const QModelIndex &idx );
79  void svgSourceChanged( const QString &source );
80  void rasterSourceChanged( const QString &source );
81  private:
82  QPointer< QgsLayoutItemPicture > mPicture;
83  QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
84  int mIconSize = 30;
85  int mBlockSvgModelChanges = 0;
86 
87  void updateSvgParamGui( bool resetValues = true );
88 };
89 
90 #endif // QGSLAYOUTPICTUREWIDGET_H
A base class for property widgets for layout items.
virtual bool setNewItem(QgsLayoutItem *item)
Attempts to update the widget to show the properties for the specified item.
virtual void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout associated with the item.
A layout item subclass that displays SVG files or raster format images (jpg, png, ....
A widget for controlling the common properties of layout items (e.g.
Base class for graphical items within a QgsLayout.
A widget for configuring layout picture items.
Interface for master layout type objects, such as print layouts and reports.