LimeReport Forum
General Category | Основное => Discussion | Обсуждение => Topic started by: Hassan on July 29, 2018, 08:48:55 pm
-
Can change TextItem Content at runtime from Qt
-
U can do this using a variable
for example:
The content of textItem is $v{variable}
from your code:
if (m_report->dataManager()->containsVariable("variable"))
m_report->dataManager()->setReportVariable("variable","Klop");
-
I mean TextItem in DataBand instead of $D{rep_sql.fieldname} in design mode, I want to fill TextItem DataBand from Qt (something like setContent).
-
I get it. And 've tipped the solve.
But using the $V{"variable"} may be incorrect.
Make next step by step:
1. Create the report variable in designer. Let it name is variable_1
2. Place the code
$S{
getVariable("variable_1");
}
as content of textItem you need to control
3. Create the instance of LimeReport::ReportEngine* in your program
4. When you need to print or preview your report call the loadFromFile method of LimeReport
5. Next call the method setVariable as I written above
if (m_report->dataManager()->containsVariable("variable_1"))
m_report->dataManager()->setReportVariable("variable_1","Klop");
m_report - it's the instance of LimeReport::ReportEngine* here