Questions tagged [qtextedit]

QTextEdit is a class from the Qt Toolkit which provides a widget that is used to edit and display both plain and rich text. It is optimized to handle large documents and to respond quickly to user input.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

575 questions
6
votes
3 answers

QTextEdit change font of individual paragraph/block

Using a QTextEdit, I need to change the font attributes of each paragraph individually. This is similar to how many word processors change the font of a paragraph when the user select a style from a menu (not a specific formatting). Ideally, I would…
Tom Duhamel
  • 61
  • 1
  • 4
6
votes
2 answers

How to change the fontsize for everything inside QTextEdit in PyQt4?

I have a QTextEdit widget whose contents are populated programmatically using QTextEdit.textCursor. My plan is to let the user view the populated information in the QTextEdit, edit the text if necessary, and later print to a PDF file using…
Chris Aung
  • 9,152
  • 33
  • 82
  • 127
6
votes
4 answers

How to give QTextFrame or QTextBlock a background-image in QTextEdit?

I am developing an IM tool,as a part of it I have to develop a BubbleChatWidget on which all message items have a bubble-like background-image.I thought I could achieve my goal with QTextEidt,but I don't know how to give 'QTextFrame' or QTextBlock a…
waterd
  • 603
  • 1
  • 7
  • 23
6
votes
2 answers

Center the Text of QTextEdit horizontally and vertically

I want to center the text of my QTextEdit horizontally and vertically. I tried this, but it didn't work. m_myTextEdit = new QTextEdit("text edit", m_ui->centralWidget); m_myTextEdit->setGeometry(5, 50, 400,…
Niklas
  • 23,674
  • 33
  • 131
  • 170
6
votes
4 answers

How to set the PlaceHolderText for QTextEdit

I want to set placeholder text of a QTextEdit. I know how to set it for a QLineEdit, there is a property setPlaceHolderText. But this property is not available for QTextEdit. Please give your valuable suggestions to solve this.
New Moon
  • 787
  • 6
  • 21
  • 35
6
votes
1 answer

Remove a line/block from QTextEdit

I'm struggling with block/line removal from QTextEdit. Code below should(?) work but it ends up in infinite loop for some unknown to me reason. I have a suspicion that next() and previous() are not welcome if QTextDocument is being…
Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95
5
votes
1 answer

Qt kerning issue

In my application I'm using a QTextEdit to display some text, using HTML for formatting. The displayed document can be printed. And here's the issue: while on screen the kerning is correct, when printed the document has a very bad looking (mainly:…
gregseth
  • 12,952
  • 15
  • 63
  • 96
5
votes
3 answers

How can I know when the Enter key was pressed on QTextEdit

I'm writing Chat gui for client on Python using PyQt5. I have a QTextEdit, which the client can write messages in it. I wan't to know when the 'Enter' key is being pressed while the focus is on the QTextEdit. I tried using installEventFilter…
Daniel Segal
  • 87
  • 3
  • 9
5
votes
1 answer

How to change color of QTextEdit widget

I'm trying to change the color of a QTextEdit to black, regardless if there's text or none, to give it a terminal look. It seems to me that the default white background color of QTextEdit (PyQy4) can't be changed by means that are otherwise working…
DorkOrc
  • 103
  • 4
  • 9
5
votes
1 answer

How do I get the currently visible text from a QTextEdit or QPlainTextEdit widget?

It seems like this would be a common thing to do, but I can't find how. I have a QTextEdit or QPlainTextEdit widget with a bunch of text. Enough that scrolling is necessary. I want another widget to give some information about the currently visible…
mmccoo
  • 8,386
  • 5
  • 41
  • 60
5
votes
5 answers

Can I have single line sized QTextEdit with simple html?

I need to display simple status row with text which will contain following styles: color bold italic QTextEdit can render simple HTML. But it also forcibly expands over multiple lines: Red background was added to emphasize the dimensions of the…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
5
votes
2 answers

QTextEdit::setTextFormat(Qt::LogText) does not exist anymore, what else can I use to log?

I need a text logger in my C++ application, QTextEdit used to have this feature until Qt 3.3 but unfortunately it has been removed. Is there an alternative that I could use?
Linoliumz
  • 2,381
  • 3
  • 28
  • 35
5
votes
1 answer

QTextObjectInterface with Qml TextEdit (QQuickTextEdit)

I registred handler for simple QTextObjectInterface, that draws just 10x10 red rectangle. When i used QTextEdit in normal QWidget app, it worked. When i used QQuickTextEdit (TextEdit qml component) in Qt Quick app, it doesn't worked (nothing is…
Krab
  • 6,526
  • 6
  • 41
  • 78
5
votes
1 answer

Qt Clear Undo History in a QTextEdit/QPlainTextEdit?

I have a QPlainTextEdit and I'm building a progress dialog for it when opening large files. Rather than using setText, I want to add one line of text at a time by using QTextCursor.insertText. The problem is that when I do it this way, I can undo…
David Ludwig
  • 967
  • 2
  • 12
  • 26
5
votes
1 answer

Qt Whenever pressed enter in QTextEdit

Whenever I pressed enter in my QTextEdit it'll perform a click on my login button. Somehow this causes a crash of my QtCreator. How can I change what'll happen If I press enter in my QTextEdit?
1 2
3
38 39