QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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 "ui_qgstableeditorformattingwidgetbase.h"
19
20#include <memory>
21
22#include "qgis_gui.h"
24#include "qgspanelwidget.h"
25
26#define SIP_NO_FILE
27
29class QgsProperty;
30
43class GUI_EXPORT QgsTableEditorFormattingWidget : public QgsPanelWidget, public QgsExpressionContextGenerator, private Ui::QgsTableEditorFormattingWidgetBase
44{
45 Q_OBJECT
46 public:
47
51 QgsTableEditorFormattingWidget( QWidget *parent = nullptr );
53
63
71
77 void setBackgroundColor( const QColor &color );
78
86 void setNumericFormat( QgsNumericFormat *format, bool isMixedFormat );
87
94 void setTextFormat( const QgsTextFormat &format );
95
102 void setRowHeight( double height );
103
110 void setColumnWidth( double width );
111
120 void setHorizontalAlignment( Qt::Alignment alignment );
121
130 void setVerticalAlignment( Qt::Alignment alignment );
131
137 void setCellProperty( const QgsProperty &property );
138
143 void setLayer( QgsMapLayer *layer );
144
151
153
154 signals:
155
161 void backgroundColorChanged( const QColor &color );
162
167
174
178 void rowHeightChanged( double height );
179
183 void columnWidthChanged( double width );
184
190 void horizontalAlignmentChanged( Qt::Alignment alignment );
191
197 void verticalAlignmentChanged( Qt::Alignment alignment );
198
204 void cellPropertyChanged( const QgsProperty &property );
205
206 private:
207 std::unique_ptr<QgsNumericFormat> mNumericFormat;
208 int mBlockSignals = 0;
209 QgsExpressionContextGenerator *mContextGenerator = nullptr;
210};
211
212#endif // QGSTABLEEDITORFORMATTINGWIDGET_H
Abstract interface for generating an expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Base class for all map layer types.
Definition qgsmaplayer.h:80
Abstract base class for numeric formatters, which allow for formatting a numeric value for display.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
A store for object properties.
void cellPropertyChanged(const QgsProperty &property)
Emitted when the cell contents property shown in the widget is changed.
void textFormatChanged()
Emitted whenever the text format shown in the widget is changed.
void verticalAlignmentChanged(Qt::Alignment alignment)
Emitted when the vertical alignment shown in the widget is changed.
void rowHeightChanged(double height)
Emitted whenever the row height shown in the widget is changed.
QgsTextFormat textFormat() const
Returns the current text format shown in the widget.
void setVerticalAlignment(Qt::Alignment alignment)
Sets the vertical alignment to show in the widget.
void setTextFormat(const QgsTextFormat &format)
Sets the text format to show in the widget.
void registerExpressionContextGenerator(QgsExpressionContextGenerator *generator)
Register an expression context generator class that will be used to retrieve an expression context fo...
QgsTableEditorFormattingWidget(QWidget *parent=nullptr)
Constructor for QgsTableEditorFormattingWidget with the specified parent widget.
void setBackgroundColor(const QColor &color)
Sets the cell background color to show in the widget.
~QgsTableEditorFormattingWidget() override
void backgroundColorChanged(const QColor &color)
Emitted whenever the cell background color is changed in the widget.
QgsNumericFormat * numericFormat()
Returns the current numeric format shown in the widget, or a nullptr if no numeric format is set.
void setCellProperty(const QgsProperty &property)
Sets the cell content's property to show in the widget.
void numberFormatChanged()
Emitted whenever the numeric format shown in the widget is changed.
void setColumnWidth(double width)
Sets the column width to show in the widget, or 0 for automatic width.
void setHorizontalAlignment(Qt::Alignment alignment)
Sets the horizontal alignment to show in the widget.
void setNumericFormat(QgsNumericFormat *format, bool isMixedFormat)
Sets the numeric format to show in the widget, or nullptr if no numeric format is set.
void horizontalAlignmentChanged(Qt::Alignment alignment)
Emitted when the horizontal alignment shown in the widget is changed.
void setLayer(QgsMapLayer *layer)
Set the layer to be used for in the expression editor context.
void columnWidthChanged(double width)
Emitted whenever the column width shown in the widget is changed.
void setRowHeight(double height)
Sets the row height to show in the widget, or 0 for automatic height.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Container for all settings relating to text rendering.
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48