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.

119 questions
47
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
  • 15,203
  • 11
  • 57
  • 106
33
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
  • 9,453
  • 7
  • 55
  • 101
22
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
  • 18,687
  • 6
  • 49
  • 70
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,737
  • 2
  • 25
  • 44
14
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
  • 28,315
  • 14
  • 88
  • 166
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
  • 394
  • 5
  • 15
9
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
  • 91
  • 1
  • 2
9
votes
2 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,112
  • 1
  • 23
  • 26
7
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,291
  • 5
  • 18
  • 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
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
  • 2,957
  • 1
  • 20
  • 51
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
  • 917
  • 1
  • 11
  • 25
4
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
  • 947
  • 1
  • 5
  • 22
4
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
  • 868
  • 2
  • 11
  • 31
4
votes
2 answers

How to override undo / redo in QPlainTextEdit

I am sub-classing QPlainText edit and I would like to be able to intercept undo / redo commands so that I can implement custom functionality. I realise that I can disable the undo / redo capability with setUndoRedoEnabled and I can detect Ctrl+Z and…
Alan Spark
  • 7,716
  • 8
  • 45
  • 88
1
2 3 4 5 6 7 8