0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-25 19:27:40 +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

@@ -173,12 +173,17 @@ public:
bool containsField(const QString& fieldName);
QVariant fieldData(const QString& fieldName);
QVariant fieldDataByRowIndex(const QString& fieldName, int rowIndex);
QVariant fieldDataByRowIndex(const QString &fieldName, int rowIndex, int role);
QVariant fieldDataByRowIndex(const QString &fieldName, int rowIndex, const QString &roleName);
QVariant fieldDataByKey(
const QString& datasourceName,
const QString& valueFieldName,
const QString& keyFieldName,
QVariant keyValue
);
QVariant headerData(const QString &fieldName, const QString &roleName);
QString columnName(const QString &datasourceName, int index);
int columnCount(const QString &datasourceName);
void reopenDatasource(const QString& datasourceName);
QString extractDataSource(const QString& fieldName);