Results 1 to 5 of 5

Thread: QTextEdit QTextDocument PageSize/PageCount

  1. #1
    Join Date
    Jul 2009
    Posts
    42
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QTextEdit QTextDocument PageSize/PageCount

    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

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTextEdit QTextDocument PageSize/PageCount

    You can use line numbers for page size. You only can decide the height of the page. BTW, whats the application?

  3. #3
    Join Date
    Jul 2009
    Posts
    42
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTextEdit QTextDocument PageSize/PageCount

    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...

    BTW, whats the application?
    Im programming a custom Code Editor with syntaxhiglighting.

    Greets

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTextEdit QTextDocument PageSize/PageCount

    You can use this for windows.
    Qt Code:
    1. int QPrinter::winPageSize () const
    2. Returns the page size used by the printer under Windows.
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jul 2009
    Posts
    42
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTextEdit QTextDocument PageSize/PageCount

    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....
    Qt Code:
    1. int page = QPrinter::winPageSize()
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Html used in QTextEdit and QTextDocument
    By nifei in forum Qt Programming
    Replies: 5
    Last Post: 15th August 2012, 20:38
  2. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  3. Drawing on QTextEdit
    By jgrauman in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2009, 09:40
  4. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  5. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.