Unsolved Best way to display and print a form document
-
Hello,
I need to display/print forms documents.
I used to do it by generating HTML code in a file, then open the file with a browser (firefox for example) to print it.
This forms documents are generated by my app, and what I want to do now is to avoid the used of the browser plus having an in app display of the form document.
I saw that Qt allow to parse HTML code but it do not support some features I use. (<textarea> and special symbols like ☐)Here is a simple HTML code generated by my app :
<!DOCTYPE html> <html> <body> <center> <h2> Question and Answer n°1 </h2> </center> <p> Question 1 : Is this a nice question ? <br> Yes it is ☐ <br> Nope ☐ <br> </p> <p> Question 2 : What would you do with 2 tons of toilet paper : <br> <textarea rows="3" cols="91"> </textarea> </p> <p> Question 3 : Connect each programming langage to your skill with it : <br> C++ ⚫ ⚫ Good <br> Java ⚫ ⚫ Medium <br> Php ⚫ ⚫ Bad <br> </p> </body> </html>
And it gives the following output :
I m kinda new to Qt but I m sure there is an easy way to display and print that kind of document.
I have take a look at the QTextDocument but how could I draw the <textarea> rect in it ?
About the QPainter, I did not managed to find the size on screen of a drawn text (in order to draw something right after it).
I m aware of the QPrinter class, what I m looking for is more a printable way to display documents like in the picture above.
If someone could light me with his knowledge about the best way to do this, it would be very helpful !
Thanks for your precious time.
Quentin P -
@QuentinP
If I understand you to be saying you do want an in-app display of the page, plus being able to send to printer, and you would have done it via an external HTML file, are you aware of Qt's QWebEnginePage, which is a Chromium offering? -
Hum that's might be what I m looking for ! Thanks a lot mate !