CellFormat.h header
#include <ew/core/CellFormat.h>
Namespace ew::core
CellFormat struct
struct ew::core::CellFormat
The visual formatting of one cell: font family/size and emphasis, foreground/background colours, horizontal alignment, and numeric rendering. A default-constructed value means "no formatting" and is never persisted, so unformatted cells cost nothing to store.
Members
bool ew::core::CellFormat::bold = false
Bold font weight.
bool ew::core::CellFormat::italic = false
Italic font style.
bool ew::core::CellFormat::underline = false
Underlined text.
bool ew::core::CellFormat::strikeOut = false
Struck-through text.
QString ew::core::CellFormat::fontFamily
Font family name (e.g. "Arial"), or empty for the table's default font.
int ew::core::CellFormat::fontPointSize = 0
Font size in points, or 0 for the table's default size.
QString ew::core::CellFormat::textColor
Foreground (text) colour as "#rrggbb", or empty for the theme default.
QString ew::core::CellFormat::backgroundColor
Background (fill) colour as "#rrggbb", or empty for no fill.
CellAlignment ew::core::CellFormat::alignment =
Horizontal alignment.
CellNumberFormat ew::core::CellFormat::numberFormat =
Numeric rendering mode.
int ew::core::CellFormat::decimalPlaces = 2
Decimal places used by every numeric mode except General (clamped to 0-15 on use).
bool ew::core::CellFormat::isDefault() const
True when every field is at its default, i.e. the format carries no information and need not be stored. The decimal-place count is ignored when the number format is General, since it then has no effect.
Enumerations
enum class CellAlignment { Default, Left, Center, Right }
Horizontal alignment of a cell's contents. Default defers to a value-based default (numbers align right, everything else left).
enum class CellNumberFormat { General, Number, Currency, Percent, Scientific }
How a cell's numeric value is rendered for display. General uses the evaluator's own formatting; the others impose a fixed number of decimal places and, for Currency and Percent, an affix.
Functions
CellAlignment ew::core::cellAlignmentFromString(QStringView text, CellAlignment fallback)
Parses an alignment persistence name, returning fallback for an unrecognized value.
CellNumberFormat ew::core::cellNumberFormatFromString(QStringView text, CellNumberFormat fallback)
Parses a number-format persistence name, returning fallback for an unrecognized value.
bool ew::core::operator!=(const CellFormat &lhs, const CellFormat &rhs)
Value inequality across every field.
bool ew::core::operator==(const CellFormat &lhs, const CellFormat &rhs)
Value equality across every field.
QString ew::core::toString(CellAlignment alignment)
The stable persistence name of alignment ("default", "left", "center", or "right").
QString ew::core::toString(CellNumberFormat format)
The stable persistence name of format ("general", "number", "currency", "percent", or "scientific").