fralx / LimeReport

Report generator for Qt Framework
http://limereport.ru/
Other
403 stars 154 forks source link

get and change databand height in QT APP or script #363

Closed liufeijin closed 2 years ago

liufeijin commented 2 years ago

Hi fralx Is there any way to get and change height of databand in QT app or script?

I found it that use "setItemHeight" to change height of item. But, i still don't know how to get the height of items. i tried DataBand1.geometry.Height , but nothing is present.

fralx commented 2 years ago

Hi! You can use something like this

Reportpage1_DataBand1.setItemHeight(Reportpage1_DataBand1.geometry.height/10+10)
liufeijin commented 2 years ago

hi fralx Many thanks , i will have a try

liufeijin commented 2 years ago

seems the height is not correct when i used
CLKHPg9T_DataFooterBand1.beforeRender.connect(Pg9T)

function Pg9T(){
   CLKHPg9T_TextItem9.setItemHeight(195-CLKHPg9_DataBand1.geometry.height/10);
}

I want the height of Textitem9 in DataFooterBand1 is follow up the height of DataBand1. but got the height is small

fralx commented 2 years ago

I want the height of Textitem9 in DataFooterBand1 is follow up the height of DataBand1.

You can use stretchToMaxHeight property for this

but got the height is small

I have tested it and for me, it works as expected :) set_geometry

liufeijin commented 2 years ago

Hi fralx I still can get the expected result. I see your demo. the databand is fixed, but in my report the databand is set to 5mm and TextItem set to 95mm. if database has 19 rows then filling 19 rows into databand, the hight of databand will be change to 95,Textitem will be changed to 5mm. maybe get the height of banddata is not the after changed size?

fralx commented 2 years ago

Could you send me example?

liufeijin commented 2 years ago

test.zip

fralx commented 2 years ago
let rowsHeight = 0
Reportpage1_DataBand1.afterRender.connect(ar)
Reportpage1_DataFooterBand6.beforeRender.connect(rr)

function ar(){
  rowsHeight += Reportpage1_DataBand1.geometry.height
}

function rr(){
  Reportpage1_DataFooterBand6.setItemHeight(253-rowsHeight/10.0);
  Reportpage1_TextItem6.setItemHeight(248-rowsHeight/10.0);
} 

I think this will help you :)

bandHeight

liufeijin commented 2 years ago

Hi fralx Many thanks for your help! It is ok now! BTW, the hotfix1.6.0 for pages order is ok also. you can merge it to master.