2

I am trying to produce a text editor similar to word (paginated) in PySide.

The way I decided to tackle this is having a QGraphicsScene with QGraphicsTextItem for each page, and to code the focus by interaction.

Now all I am trying to do now is have a box representing an A4 page, and handling textchanged events using the QGraphicsTextItem.document().pageCount() function.

I bumped into several issues:

  1. How can I properly define the size of the page given the QSizeF is not using any units? Will defining this right guarantee a true return value from pageCount()?

  2. If I define a pageSize at all, QGraphicsTextItem stops expanding. How can I set a fixed size so It'll look like a page?

Documentation for Qt is extremely light and I could not figure anything out of it.

Thank you for helping

W.F
  • 21
  • 1

1 Answers1

0

Since Qt 5.3, QPageSize has everything you need to find out page sizes in any units desired.

David Faure
  • 1,836
  • 15
  • 19