Important: Please read the Qt Code of Conduct -

[SOLVED] How to adjust QPrintPreviewWidget?

  • I am searching for different ways to get things done in Qt.
    At the moment I am trying to adjust the QGraphicsItem in a QPrintPreviewWidget. I did not found a way by subclassing is, so I thought it would be best to rebuild the existing QPrintPreviewWidget with only those options I need.

    Problem is the inclusion of "private/qwidget_p.h" and <private/qprinter_p.h>.
    My question is how I can rebuild a single widget without rebuilding the entire development environment?

    Someone an idea?

  • Well, last night I had some time to experiment on this old question of mine and I came up with a possilble solution.

    The first step was for me to recreate qprintpreviewwidget and when successfull, adjust it to my needs.

    So I took the sourcecode from qprintpreviewwidget and split them up in four classes, PageItem, GraphicsView, Preview and PreviewPrivate.
    After that I combined Preview and PreviewPrivate into one class Preview.

    The above gives me an almost working example, I only have to find a way to retrieve a list of pages from QPrinter or an alternative solution.

    Any ideas on this would be fine!!

  • For now I will mark this post as solved. Although not having a working solution yet, it seems I'm almost there. I found several clues in the source of qprinter and qpaintengine_preview, so I have at the moment enough options I could try.

Log in to reply