Questions tagged [qplaintextedit]

QPlainTextEdit is class in QtGui module which provides a widget that is used to edit and display plain text.

QPlainTextEdit is class in QtGui module which provides a widget that is used to edit and display plain text.

136 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
39
votes
4 answers

How to append text to QPlainTextEdit without adding newline, and keep scroll at the bottom?

I need to append text to QPlainTextEdit without adding a newline to the text, but both methods appendPlainText() and appendHtml() adds actually new paragraph. I can do that manually with QTextCursor: QTextCursor text_cursor =…
Dmitry Frank
  • 10,417
  • 10
  • 64
  • 114
23
votes
1 answer

QSyntaxHighlighter - text selection overrides style

I'm making a custom code editor with QPlainTextEdit and QSyntaxHighlighter and I've encountered a glitch. I'd like to preserve syntax highlighting even within a selection. However, colors of the selection (environment colors) override the colors of…
LogicStuff
  • 19,397
  • 6
  • 54
  • 74
17
votes
1 answer

PyQt: How to reset the cursor to whatever it's hovering over

Very small issue: I've written a small IDE with a text editing widget based on a QPlainTextEdit. When you move the mouse over it the cursor becomes a caret/text cursor as expected. If you hit F5 the window is disabled and a small script runs after…
Michael Clerx
  • 2,928
  • 2
  • 33
  • 47
15
votes
2 answers

QPlainTextEdit truncate history linewise

I have a GUI application whose main part is a QPlainTextEdit. It is used to display a log of the application, and as such the associated text grows line by line ad infinitum. As the application is intended to run very long, I need to limit the…
moooeeeep
  • 31,622
  • 22
  • 98
  • 187
11
votes
2 answers

How to scroll QPlainTextEdit to top?

I would like to automatically scroll to the top in a QPlainTextEdit widget after put in some text. How can I realize that?
martin k
  • 111
  • 1
  • 3
11
votes
3 answers

Qt formlayout not expanding qplaintextedit vertically

I'm confused why a QPlainTextEdit widget will not resize vertically when added to a QFormLayout. In the code below the text field correctly scales up horizontally, but does not scale up vertically. Can anyone explain this behavior and offer a…
Jon Lauridsen
  • 2,521
  • 5
  • 31
  • 38
10
votes
1 answer

How to change the width of tabs in a QPlainTextEdit

When using the QPlaintextEdit in PyQt5, if I press the Tab button on my keyboard I get a tab space which is equal to size of six spaces together. But I want it to be the size of four spaces, so that when I use: TextEdit.setPlainTextEdit('\t') I…
Nikhil.Nixel
  • 555
  • 2
  • 11
  • 25
9
votes
3 answers

Qt5: Tell QPlainTextEdit to ignore syntax highlighting changes

I have a QPlainTextEdit widget in my application which has a QSyntaxHighlighter assigned to it. Upon each content change within that text edit area, I need to get a notification (to update the global application save/changed state). However, the…
Philip Allgaier
  • 3,505
  • 2
  • 26
  • 53
8
votes
1 answer

Access the widget of a tab in a QTabWidget

I have a QTabWidget, where each tab has a QPlainTextEdit as its widget. So, how do I access each tab widget? How do I edit that widget?
Kazuma
  • 1,371
  • 6
  • 19
  • 33
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

how to create tooltip for highlighted strings in QPlainTextEdit

I have a QPlainTextEdit and have some words highlighted in it now I want when I hover over it with the mouse it show me a tooltip that has description or something like that about this highlighted word something like this in QT IDE but I don't know…
user7179690
  • 1,051
  • 3
  • 17
  • 40
5
votes
1 answer

How to retain Syntax Highlighting during text highlight

In most code editors, the text highlight does not remove the syntax colors. For example: Visual Studio Sublime Text I would like to simulate this function in the code editor I'm making in QT; however, the text highlight turns all of the text…
Griffort
  • 1,174
  • 1
  • 10
  • 26
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
4
votes
1 answer

Increase the bottom margin in QTextEdit

I need to make the scrollbar enabled even if the number of lines is less than the height of the QTextEdit, like in below pic I tried setDocumentMargin() but it makes margin in all directions (left, right, top, and bottom) So, is there a way to…
1
2 3
9 10