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
56
votes
1 answer

QTextEdit vs QPlainTextEdit

What's the difference between QTextEdit and QPlainTextEdit, why use one over the other? I'm coding a text editor as an exercice to learn Qt5, and now I'm wondering whether to use QTextEdit or QPlainTextEdit. So far I've only found out that you can…
Markus Meskanen
  • 19,939
  • 18
  • 80
  • 119
32
votes
6 answers

QTextEdit with different text colors (Qt / C++)

I have a QTextEdit box that displays text, and I'd like to be able to set the text color for different lines of text in the same QTextEdit box. (i.e. line 1 might be red, line 2 might be black, etc.) Is this possible in a QTextEdit box? If not,…
user924
  • 635
  • 1
  • 9
  • 9
31
votes
3 answers

How to change row height in QTextTable

I'm writing the complicated rich text editor, derived from QTextEdit class. It must be able to insert, resize, and apply various formatting to embedded tables. I found function for setup column widths (setColumnWidthConstraints). But there is no one…
eraxillan
  • 1,552
  • 1
  • 19
  • 40
22
votes
5 answers

How to override tab width in qt?

I just need to know how to change the tab size in Qt in a QTextEdit. My Google and stackoverflow search returned me null. Thanks in advance.
Barış Akkurt
  • 2,255
  • 3
  • 22
  • 37
21
votes
2 answers

Several ways of placing an image in a QTextEdit

I think this is a very simple question, but when I copy an image I can't paste it in a QTextEdit? Paste is inactive! Also I would like to know how to drag-and-drop a picture. BTW I use the following code in order to insert a picture into a…
Narek
  • 38,779
  • 79
  • 233
  • 389
20
votes
1 answer

Get text from qtextedit and assign it to a variable

When I try to get the text from the qtextedit created with PyQt5 Designer I get an error or "Python stop working" and the script stop automatically. I've tried multiple solutions but nothing works. I have to assign the text from the qtextedit to a…
Abunis
  • 207
  • 1
  • 2
  • 9
19
votes
6 answers

How to program scrollbar to jump to bottom/top in case of change in QPlainTextEdit or QTextEdit area?

How to program scrollbar to jump to bottom/top in case of change in QPlainTextEdit or QTextEdit area? It looks like it doesn't have any controlling function.
falconium
  • 199
  • 1
  • 1
  • 3
19
votes
1 answer

How to get the whole text from text edit QT

I am trying to get the text from a text edit and store it in a QString . When I write this QString text = ui->textEdit->toPlainText(); it only reads the text before the first '\n' So how can I get the whole text with '\n's in it. This is being…
samvel1024
  • 1,123
  • 4
  • 15
  • 39
18
votes
5 answers

How to set number of lines for an QTextEdit?

I use a QTextEdit for some inputs. But I want to adjust the height of the box. Can I set the height based on the number of lines I want to have visible at a time?
Mnementh
  • 50,487
  • 48
  • 148
  • 202
17
votes
3 answers

QTextEdit. How to select text manually?

There are functions like textEdit->textCursor()->selectionStart() and textEdit->textCursor()->selectionEnd(), but there are no functions setSelectionStart, setSelectionEnd. Is there any way to select some part of text manually?
TheHorse
  • 2,787
  • 1
  • 23
  • 32
17
votes
1 answer

How to make links clickable in a QTextEdit?

Is there a way to make links clickable in a QTextEdit? I know I can use a QTextBrowser and connect to anchorClicked but I'd rather keep the editing and viewing all in one widget, and have clickable links when I set the widget to read-only mode. Is…
dF.
  • 74,139
  • 30
  • 130
  • 136
14
votes
5 answers

qtextedit - resize to fit

I have a QTextEdit which act as "displayer" (editable to false). The text it displays is wordwrapped. Now I do wish to set the height of this textbox so that the text fits exactly (while also respecting a maximum height). Basically the widget (in…
paul23
  • 8,799
  • 12
  • 66
  • 149
14
votes
5 answers

Clickable hyperlink in QTextEdit

I want to use QTextEdit (in read-only mode) to show a clickable hyperlink, I used to do QTextEdit *textEdit = new QTextEdit; QTextCursor cursor(textEdit->document()); textEdit->setTextCursor(cursor); cursor->insertHtml("
Kha Tran
  • 193
  • 1
  • 1
  • 10
14
votes
2 answers

Resizing QT's QTextEdit to Match Text Height: maximumViewportSize()

I am trying to use a QTextEdit widget inside of a form containing several QT widgets. The form itself sits inside a QScrollArea that is the central widget for a window. My intent is that any necessary scrolling will take place in the main…
Aaron
  • 423
  • 1
  • 4
  • 12
14
votes
2 answers

Moving the cursor inside of QTextEdit

I have a form with a QTextEdit on it, which is called translationInput. I am trying to provide the editing functionality for the user. This QTextEdit will contain HTML-formatted text. I have a set of buttons, like "bold", "Italic", and so on, which…
SingerOfTheFall
  • 29,228
  • 8
  • 68
  • 105
1
2 3
38 39