0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-30 13:07:11 +03:00

Add: added a function to get an arbitrary role of a model item

Example:
$D{appdata.Column_1}
$S{
var vRow = line('DataBand1') - 1;
// 8 - Qt::BackgroundRole
var vColor = getFieldByRowIndexEx('appdata.Column_1', vRow, 8);

THIS.backgroundColor = LimeReport.color('lightgray');
if(vColor > '')
{
	THIS.backgroundColor = vColor;
}
''
}

Added several functions to get extended information from the model

- getFieldByRowIndexEx2(fieldName, rowIndex, roleName), default:
Qt::DisplayRole

- getHeaderData(fieldName, roleName), default: Qt::DisplayRole

- getHeaderColumnNameByIndex(datasourceName, columnIndex), default:
Qt::UserRole or Qt::DisplayRole

- getColumnCount(datasourceName), default: -1
This commit is contained in:
Dmitry Zagorodnev
2024-03-26 11:43:58 +03:00
parent 2b388b02fe
commit 4c1c0c49e6
7 changed files with 261 additions and 0 deletions

View File

@@ -18,9 +18,12 @@ public:
virtual bool eof() = 0;
virtual QVariant data(const QString& columnName) = 0;
virtual QVariant dataByRowIndex(const QString& columnName, int rowIndex) = 0;
virtual QVariant dataByRowIndex(const QString &columnName, int rowIndex, int roleName) = 0;
virtual QVariant dataByRowIndex(const QString &columnName, int rowIndex, const QString &roleName) = 0;
virtual QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData) = 0;
virtual int columnCount() = 0;
virtual QString columnNameByIndex(int columnIndex) = 0;
virtual QVariant headerData(const QString &columnName, const QString &roleName) = 0;
virtual int columnIndexByName(QString name) = 0;
virtual bool isInvalid() const = 0;
virtual QString lastError() = 0;