Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is there a way to draw geometric shapes below the text in a QTextDocument?
Forum Updated to NodeBB v4.3 + New Features

Is there a way to draw geometric shapes below the text in a QTextDocument?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtextdocumentprinttopdfprintpaintshapes
1 Posts 1 Posters 340 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jeanmilostJ Offline
    jeanmilostJ Offline
    jeanmilost
    wrote on last edited by
    #1

    I need to create a text document, which should be both drawn in a view on the user interface and printed, especially to a PDF file.

    About the text itself, I know how to perform all I need to do. I know how to align my text, create paragraphs, insert images, set the font, manipulate the layouts, ...

    But an important point is missing to achieve my text document: I need to draw geometrical shapes in the background of several paragraphs, e.g a rounded rectangle.

    On the user interface I may access to a QPainter to workaround that. However I need the exact same rendering on the user interface and on the printed document. And using the same workaround during the print process will force me to write my own function, which is a painful way and misses the opportunity to use the print() function provided by the QTextDocument class, which already provides all I need, like page cutting.

    On the other hand, I tried to add such background shapes by writing a css code, however a such feature seems to be out of the scope of the limited css supported by Qt.

    So is there a way to add geometrical shapes (e.g rectangles, circles, ellipses, paths, ...) in a QTextDocument, and if yes, how to achieve that?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved