QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgstablecell.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstablecell.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 QGSTABLECELL_H
16
#define QGSTABLECELL_H
17
18
#include <memory>
19
20
#include "qgis_core.h"
21
#include "
qgis_sip.h
"
22
#include "
qgstextformat.h
"
23
24
#include <QColor>
25
#include <QString>
26
#include <QVariant>
27
28
using namespace
Qt::StringLiterals;
29
30
class
QgsNumericFormat
;
31
class
QgsReadWriteContext
;
32
40
class
CORE_EXPORT
QgsTableCell
41
{
42
public
:
46
QgsTableCell
(
const
QVariant &
content
= QVariant() );
47
48
QgsTableCell
(
const
QgsTableCell
&other );
49
50
~QgsTableCell
();
51
52
QgsTableCell
&
operator=
(
const
QgsTableCell
&other );
53
59
QVariant
content
()
const
{
return
mContent; }
60
66
void
setContent
(
const
QVariant &
content
) { mContent =
content
; }
67
73
QColor
backgroundColor
()
const
{
return
mBackgroundColor; }
74
82
void
setBackgroundColor
(
const
QColor &color ) { mBackgroundColor = color; }
83
89
QColor
foregroundColor
()
const
{
return
mForegroundColor; }
90
98
void
setForegroundColor
(
const
QColor &color ) { mForegroundColor = color; }
99
108
QgsTextFormat
textFormat
()
const
{
return
mTextFormat; }
109
118
void
setTextFormat
(
const
QgsTextFormat
&format ) { mTextFormat = format; }
119
125
const
QgsNumericFormat
*numericFormat()
const
;
126
134
void
setNumericFormat(
QgsNumericFormat
*format
SIP_TRANSFER
);
135
143
Qt::Alignment horizontalAlignment()
const
;
144
152
void
setHorizontalAlignment( Qt::Alignment alignment );
153
161
Qt::Alignment verticalAlignment()
const
;
162
170
void
setVerticalAlignment( Qt::Alignment alignment );
171
180
void
setSpan(
int
rowSpan,
int
columnSpan );
181
190
int
rowSpan
()
const
{
return
mRowSpan; }
191
200
int
columnSpan
()
const
{
return
mColumnSpan; }
201
207
QVariantMap properties(
const
QgsReadWriteContext
&context )
const
;
208
214
void
setProperties(
const
QVariantMap &properties,
const
QgsReadWriteContext
&context );
215
216
217
#ifdef SIP_RUN
218
// clang-format off
219
SIP_PYOBJECT __repr__();
220
% MethodCode
221
QString str = u
"<QgsTableCell: %1>"
_s.arg( sipCpp->content().toString() );
222
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
223
% End
224
// clang-format on
225
#endif
226
227
// clang-format off
228
private
:
229
// clang-format on
230
231
QVariant mContent;
232
QColor mBackgroundColor;
233
QColor mForegroundColor;
234
QgsTextFormat
mTextFormat;
235
std::unique_ptr< QgsNumericFormat > mFormat;
236
237
Qt::Alignment mHAlign = Qt::AlignLeft;
238
Qt::Alignment mVAlign = Qt::AlignVCenter;
239
240
int
mRowSpan = 1;
241
int
mColumnSpan = 1;
242
};
243
249
typedef
QVector<QgsTableCell>
QgsTableRow
;
250
251
#ifndef SIP_RUN
252
258
typedef
QVector<QgsTableRow>
QgsTableContents
;
259
#else
260
266
typedef
QVector<QVector<QgsTableCell>>
QgsTableContents
;
267
#endif
268
269
270
#endif
// QGSTABLECELL_H
QgsNumericFormat
Abstract base class for numeric formatters, which allow for formatting a numeric value for display.
Definition
qgsnumericformat.h:232
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
QgsTableCell::columnSpan
int columnSpan() const
Returns the column span for the cell.
Definition
qgstablecell.h:200
QgsTableCell::QgsTableCell
QgsTableCell(const QVariant &content=QVariant())
Constructor for QgsTableCell, with the specified content.
Definition
qgstablecell.cpp:27
QgsTableCell::setBackgroundColor
void setBackgroundColor(const QColor &color)
Sets the cell's background color.
Definition
qgstablecell.h:82
QgsTableCell::foregroundColor
QColor foregroundColor() const
Returns the cell's foreground color, or an invalid color if a default color should be used for the fo...
Definition
qgstablecell.h:89
QgsTableCell::setTextFormat
void setTextFormat(const QgsTextFormat &format)
Sets the cell's text format.
Definition
qgstablecell.h:118
QgsTableCell::setContent
void setContent(const QVariant &content)
Sets the cell's content.
Definition
qgstablecell.h:66
QgsTableCell::content
QVariant content() const
Returns the cell's content.
Definition
qgstablecell.h:59
QgsTableCell::textFormat
QgsTextFormat textFormat() const
Returns the cell's text format.
Definition
qgstablecell.h:108
QgsTableCell::operator=
QgsTableCell & operator=(const QgsTableCell &other)
Definition
qgstablecell.cpp:45
QgsTableCell::setForegroundColor
void setForegroundColor(const QColor &color)
Sets the cell's foreground color.
Definition
qgstablecell.h:98
QgsTableCell::rowSpan
int rowSpan() const
Returns the row span for the cell.
Definition
qgstablecell.h:190
QgsTableCell::~QgsTableCell
~QgsTableCell()
QgsTableCell::backgroundColor
QColor backgroundColor() const
Returns the cell's background color, or an invalid color if a default color should be used for the ba...
Definition
qgstablecell.h:73
QgsTextFormat
Container for all settings relating to text rendering.
Definition
qgstextformat.h:44
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
QgsTableContents
QVector< QgsTableRow > QgsTableContents
A set of table rows.
Definition
qgstablecell.h:258
QgsTableRow
QVector< QgsTableCell > QgsTableRow
A row of table cells.
Definition
qgstablecell.h:249
qgstextformat.h
Generated on
for QGIS API Documentation by
1.17.0