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
12
votes
2 answers

A QWidget like QTextEdit that wraps its height automatically to its contents?

I am creating a form with some QTextEdit widgets. The default height of the QTextEdit exceeds a single line of text and as the contents' height exceeds the QTextEdit's height, it creates a scroll-bar to scroll the content. I would like to override…
neydroydrec
  • 6,973
  • 9
  • 57
  • 89
11
votes
4 answers

Qt rich text editor - is there an already-made one?

I need a rich text editor for Qt. I've been thinking about using QTextEdit since it's a rich text edit, but I need two things that aren't present in that widget: The user should be able to change the text color, the text font, underline, bold,…
Johnny Pauling
  • 12,701
  • 18
  • 65
  • 108
10
votes
1 answer

Scroll QTextBrowser to the top

I have the following: QString html = ui->DetailsTextBrowser->document()->toHtml(); html = details.replace("#VERSION", "1.0"); ui->DetailsTextBrowser->document()->setHtml(details); Unfortunately after the HTML content of the DetailsTextBrowser is…
Gad D Lord
  • 6,620
  • 12
  • 60
  • 106
9
votes
2 answers

QTextEdit and colored bash-like output emulation

I have an escape sequences in a text, like char const * text = "\e[1;33m" "some colored text" "\e[0m"; Which usually printed in terminal. But I want to forward this text in QTextEdit. What is the simpliest way to make such text in QTextEdit…
Tomilov Anatoliy
  • 15,657
  • 10
  • 64
  • 169
9
votes
3 answers

How do I use QTextBlock?

I'm completely new to C++ and Qt. I want to populate a QTextEdit object with QTextBlocks, how do I do that? e.g. If I have the sentence "the fish are coming" how would I put each word into its own QTextBlock and add that block to QTextEdit, or have…
jcuenod
  • 55,835
  • 14
  • 65
  • 102
9
votes
1 answer

How to highlight a string of text within a QTextEdit

I'm a student programmer currently developing an application for work using Qt4. I am building an equation editor and I'm having issues attempting to highlight a string within my QTextEdit field. I have a function that parses through the QTextEdit…
Wylie Coyote SG.
  • 1,009
  • 6
  • 22
  • 37
8
votes
5 answers

How to adjust QTextEdit to fit it's contents

I'm developing a Qt Application and I'm trying to find a way to use QTextEdit as a label with long text without the scroll bar. In my ui I have a QScrollArea and inside of it I want to place a couple off QTextEdit widgets and I only want use…
madasionka
  • 812
  • 2
  • 10
  • 29
7
votes
2 answers

How to disable the cursor in QTextEdit?

I am now using QTextEdit with qt virtual keyboard, and I face an issue with QTextEdit I want to disable the textcursor in QTextEdit. I tried to use setCursorWidth(0); The textcursor does disappear. But when I use arabic keybaord, there will be a…
tako
  • 71
  • 5
7
votes
2 answers

Apply stylesheet to HTML content in QTextEdit

I have a QTextEdit where I do display some HTML. Could I apply a stylesheet to that very HTML content? Do not confuse it with applying a Qt stylesheet to the QTextEdit (that I know). I want to change the appearance of what is in the QTextEdit widget…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
7
votes
2 answers

PyQt5 QTextEdit auto completion

Looking for a way to have an auto completion with a QTextEdit and QCompleter. I have read that it is possible but didn't find any example... I'm using python3.4 and PyQt5 I'm looking for a very basic example thanks for any help
kokito
  • 1,114
  • 1
  • 13
  • 19
7
votes
3 answers

Making changes to a QTextEdit without adding an undo command to the undo stack

I'm looking for a way to change the QTextCharFormat of a QTextEdit's QTextBlock without triggering the addition of an undo command. Let me explain: The QTextCharFormat of a QTextBlock can be easily changed by using the…
user3483225
  • 121
  • 1
  • 5
7
votes
1 answer

Prevent a QTextEdit widget from scrolling when there is a selection

I've researched this extensively but haven't found a satisfactory solution yet: How do I append text at the end of QTextEdit widget without triggering a scroll to the bottom of the widget when either of these conditions is met: The user has…
François Beaune
  • 4,270
  • 7
  • 41
  • 65
7
votes
1 answer

Use keyPressEvent to catch enter or return

I have a simple form with some combos, labels, buttons and a QTextEdit. I try to catch the enter or return key with keyPressEvent, but for some reason I'm not able to. The ESC key however, that I also use, is recognized. Here's a piece of the code: …
zappfinger
  • 497
  • 2
  • 5
  • 15
6
votes
1 answer

Qt QTextEdit adds spurious line

Look at this tiny piece of Qt code qDebug() << "CONTENT" << content; QTextEdit *te = new QTextEdit(this); te->setHtml(content); qDebug() << "CONTENT AFTER " << te->toHtml(); Content initially contains this HTML
Davide Berra
  • 6,387
  • 2
  • 29
  • 50
6
votes
3 answers

Create text area (textEdit) with line number in PyQt

I want to create textEdit with line number on the left side in PyQt like Notepad++. I tried this adding another textEdit but scrolling is stuck. I searched and found this question, but there is no good solution for it.
bzimor
  • 1,618
  • 2
  • 14
  • 26
1
2
3
38 39