PDA

View Full Version : QTextEdit QTextDocument PageSize/PageCount



ericV
3rd August 2009, 13:53
Hi,

Im trying to add a label on my statusbar witch should contain the current pagenumber and the pagecount.

For this I need to setup the pagesize for the document first...
now I was wondering if it is somehow possible to use the QPrinter::PaperSize?
But i dont know how to get to the height/width constants... since only an enum int is returned (correct me if im wrong)

Any tips?

Thanks

yogeshgokul
3rd August 2009, 13:57
You can use line numbers for page size. You only can decide the height of the page. BTW, whats the application?

ericV
3rd August 2009, 14:01
Thanks for the reply....


You can use line numbers for page size

Well i would still need to know how many lines fit into a Page... I could print a page out and see how many fit in a page and then set this value as default...
Might be the easiest way since A4 paper is the standard... :p


BTW, whats the application?

Im programming a custom Code Editor with syntaxhiglighting.

Greets

yogeshgokul
3rd August 2009, 14:04
You can use this for windows.

int QPrinter::winPageSize () const
Returns the page size used by the printer under Windows.

ericV
3rd August 2009, 14:37
Ok... Im looking into this, but i dont see the conection between the int retunrned and the page number...

and calling the function directly doesent work....

int page = QPrinter::winPageSize()