Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: TextItem Content  (Read 1758 times)

Hassan

  • Newbie
  • *
  • Posts: 19
    • View Profile
TextItem Content
« on: July 29, 2018, 08:48:55 PM »
Can change TextItem Content at runtime from Qt

Subst

  • Sr. Member
  • ****
  • Posts: 444
    • View Profile
Re: TextItem Content
« Reply #1 on: July 30, 2018, 10:41:07 AM »
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");
« Last Edit: July 30, 2018, 10:44:32 AM by Subst »

Hassan

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: TextItem Content
« Reply #2 on: July 30, 2018, 11:53:45 AM »
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).

Subst

  • Sr. Member
  • ****
  • Posts: 444
    • View Profile
Re: TextItem Content
« Reply #3 on: July 30, 2018, 12:57:03 PM »
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