Formats conditioned to row-id values to allow free cell formatting

The conditional formatting is extended to cover free single-cell
formatting. The row-id formats have precedence over regular conditional
formats.

In the styling toolbar, when single cells are selected, row-id formats are
created or updated. When entire columns are selected, regular conditional
formats are instead. Clearing formats for entire columns, remove both. For
single cells, only corresponding row-id formats.

New row-id formats are also saved to project files and loaded.

See issue #1976
This commit is contained in:
mgrojo
2019-10-27 01:19:11 +02:00
parent bf62a6e441
commit 5aeca230fc
8 changed files with 258 additions and 126 deletions

View File

@@ -4,6 +4,9 @@
#include <QString>
#include <QColor>
#include <QFont>
#include <QModelIndex>
class QAbstractTableModel;
// Conditional formatting for given format to table cells based on a specified condition.
class CondFormat
@@ -27,12 +30,18 @@ public:
static Alignment fromCombinedAlignment(Qt::Alignment align);
CondFormat() {}
explicit CondFormat(const QString& filter,
const QColor& foreground,
const QColor& background,
const QFont& font,
const Alignment alignment = AlignLeft,
const QString& encoding = QString());
CondFormat(const QString& filter,
const QColor& foreground,
const QColor& background,
const QFont& font,
const Alignment alignment = AlignLeft,
const QString& encoding = QString());
// Create a new CondFormat from values obtained from the model
CondFormat(const QString& filter,
const QAbstractTableModel* model,
const QModelIndex index,
const QString& encoding = QString());
static QString filterToSqlCondition(const QString& value, const QString& encoding = QString());