Questions tagged [qtextdocument]

The QTextDocument class, part of the Qt framework, holds formatted text that can be viewed and edited using a QTextEdit.

Documentation can be found here (Qt4) and here (Qt5).

124 questions
10
votes
1 answer

QTextDocument::drawContents only renders at 96 dpi

I am creating a high-resolution (1200 dpi) PDF document using QPrinter and QPainter. I am trying to draw text at the same resolution using QTextDocument::drawContents. The reason I want to use QTextDocument is because I need to include many tables…
d11
  • 1,344
  • 17
  • 15
8
votes
2 answers

Problem in Moving QTextCursor to the End

I'm trying to implement a simple text search in an editor i'm writing. Everything have been fine until this problem! I'm trying to implement a backward search here. The procedure is: look for the subject backward, if not found, beep once, and if…
arashka
  • 1,226
  • 3
  • 17
  • 30
8
votes
1 answer

Set QGraphicsTextItem text contents of exact height and width

I am required to create text items with exact width and height of text contents. The height of the text is the most important requirement. The position of the text should be relative to the text itself. I also have to be able to place it on canvas…
Thalia
  • 13,637
  • 22
  • 96
  • 190
7
votes
3 answers

How can I access the QUndoStack of a QTextDocument?

How can I access the QUndoStack of a QTextDocument? (For example, I want to be able to add custom QUndoCommand objects to the document's undo stack)
Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
6
votes
1 answer

Hiding text with QSyntaxHighlighter

Problem: I want to implement a text editing widget for text with additional tags. I'd like some tags to be invisible in some cases so that they do not distract the user. Environment: I'm using PyQt and prefer to use QPlainTextWidget and…
6
votes
2 answers

QPrinter unable to style HTML page properly to render image in PDF document

I want to create a PDF document with properly styled HTML. This is what I am trying: QTextDocument *doc = new QTextDocument(); const char* s1 = "