QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgstableeditorformattingwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstableeditorformattingwidget.h
3  --------------------------------
4  begin : January 2020
5  copyright : (C) 2020 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSTABLEEDITORFORMATTINGWIDGET_H
16 #define QGSTABLEEDITORFORMATTINGWIDGET_H
17 
18 #include "qgis_gui.h"
19 #include "ui_qgstableeditorformattingwidgetbase.h"
20 #include "qgspanelwidget.h"
22 #include <memory>
23 
24 #define SIP_NO_FILE
25 
26 class QgsNumericFormat;
27 class QgsProperty;
28 
41 class GUI_EXPORT QgsTableEditorFormattingWidget : public QgsPanelWidget, public QgsExpressionContextGenerator, private Ui::QgsTableEditorFormattingWidgetBase
42 {
43  Q_OBJECT
44  public:
45 
49  QgsTableEditorFormattingWidget( QWidget *parent = nullptr );
51 
60  QgsNumericFormat *numericFormat() SIP_TRANSFERBACK;
61 
68  QgsTextFormat textFormat() const;
69 
75  void setBackgroundColor( const QColor &color );
76 
84  void setNumericFormat( QgsNumericFormat *format, bool isMixedFormat );
85 
92  void setTextFormat( const QgsTextFormat &format );
93 
100  void setRowHeight( double height );
101 
108  void setColumnWidth( double width );
109 
118  void setHorizontalAlignment( Qt::Alignment alignment );
119 
128  void setVerticalAlignment( Qt::Alignment alignment );
129 
135  void setCellProperty( const QgsProperty &property );
136 
142  void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
143 
145 
146  signals:
147 
153  void backgroundColorChanged( const QColor &color );
154 
158  void numberFormatChanged();
159 
165  void textFormatChanged();
166 
170  void rowHeightChanged( double height );
171 
175  void columnWidthChanged( double width );
176 
182  void horizontalAlignmentChanged( Qt::Alignment alignment );
183 
189  void verticalAlignmentChanged( Qt::Alignment alignment );
190 
196  void cellPropertyChanged( const QgsProperty &property );
197 
198  private:
199 
200  std::unique_ptr< QgsNumericFormat > mNumericFormat;
201  int mBlockSignals = 0;
202  QgsExpressionContextGenerator *mContextGenerator = nullptr;
203 
204 };
205 
206 #endif // QGSTABLEEDITORFORMATTINGWIDGET_H
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
QgsProperty
A store for object properties.
Definition: qgsproperty.h:230
QgsTableEditorFormattingWidget
A reusable widget for formatting the contents of a QgsTableCell.
Definition: qgstableeditorformattingwidget.h:41
QgsNumericFormat
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
Definition: qgsnumericformat.h:259
SIP_TRANSFERBACK
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
QgsTextFormat
Container for all settings relating to text rendering.
Definition: qgstextformat.h:40
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsExpressionContextGenerator::createExpressionContext
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
qgsexpressioncontextgenerator.h
qgspanelwidget.h
QgsExpressionContextGenerator
Abstract interface for generating an expression context.
Definition: qgsexpressioncontextgenerator.h:36