QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
qgslayoutlabelwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutlabelwidget.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 QGSLAYOUTLABELWIDGET_H
19 #define QGSLAYOUTLABELWIDGET_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_qgslayoutlabelwidgetbase.h"
26 #include "qgslayoutitemwidget.h"
27 #include "qgslayoutitemlabel.h"
28 #include <functional>
29 
37 class GUI_EXPORT QgsLayoutLabelWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayoutLabelWidgetBase
38 {
39  Q_OBJECT
40  public:
42  explicit QgsLayoutLabelWidget( QgsLayoutItemLabel *label );
43  void setMasterLayout( QgsMasterLayoutInterface *masterLayout ) override;
44 
59  static void buildInsertDynamicTextMenu( QgsLayout *layout, QMenu *menu, const std::function< void( const QString &expression ) > &callback );
60 
61  protected:
62 
63  bool setNewItem( QgsLayoutItem *item ) override;
64 
65  private slots:
66  void mHtmlCheckBox_stateChanged( int i );
67  void mTextEdit_textChanged();
68  void mInsertExpressionButton_clicked();
69  void mMarginXDoubleSpinBox_valueChanged( double d );
70  void mMarginYDoubleSpinBox_valueChanged( double d );
71  void mFontColorButton_colorChanged( const QColor &newLabelColor );
72  void mCenterRadioButton_clicked();
73  void mLeftRadioButton_clicked();
74  void mRightRadioButton_clicked();
75  void mTopRadioButton_clicked();
76  void mBottomRadioButton_clicked();
77  void mMiddleRadioButton_clicked();
78  void setGuiElementValues();
79  void fontChanged();
80  void justifyClicked();
81 
82  private:
83  QPointer< QgsLayoutItemLabel > mLabel = nullptr;
84 
85  QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
86 
87  QMenu *mDynamicTextMenu = nullptr;
88 
89  void blockAllSignals( bool block );
90 };
91 
92 #endif //QGSLAYOUTLABELWIDGET_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 for text labels.
A widget for controlling the common properties of layout items (e.g.
Base class for graphical items within a QgsLayout.
A widget for layout item settings.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
Interface for master layout type objects, such as print layouts and reports.