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
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
  • 8,152
  • 8
  • 56
  • 91
3
votes
1 answer

Save to HTML with QPlainTextEdit

I am writing a Text Editor using the Qt C++ framework. I'm using a QPlainTextEdit as the central widget where the user writes out his document. The text can be bolded, italicised and coloured. I'm having a problem when it comes to writing the save…
W.K.S
  • 9,787
  • 15
  • 75
  • 122
3
votes
1 answer

How to get a QTextBlock's offset relative to the current document layout?

Given a text block, is there a way to determine its offset relative to the coordinates (0, 0) of the current document layout? For example, suppose I have a QPlainTextEdit with the following contents: Line 1 Line 2 If the height of each line is…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
3
votes
1 answer

Python PyQt5 print multi-color to plaintextedit

To make this easier. How would I print to a QPlainTextEdit the list ['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'] using a different color for each word?
Halloween
  • 388
  • 3
  • 15
3
votes
2 answers

Highlighting portions of text in QPlainTextEdit

I have a list in QPlainTextEdit and want to highlight a specific line, line number 5 say. I looked at various tutorials and examples, but the documentation of PyQt5 seems rather sparse. Workable code, I would like to highlight lines. For a…
monos
  • 75
  • 1
  • 6
3
votes
1 answer

QPlainTextEdit - searches the document to the end and again from the beginning

I want to search in QPlainTextEdit for a string from the current cursor to the end. If nothing is found I want to continue searching from the start. Only in this stage, if nothing is found, a message will appear. This is the code: void…
Junior
  • 507
  • 5
  • 19
3
votes
1 answer

QPlainTextEdit double click event

I need to capture the double click event on a QPlainTextEdit that is inside a QDockWidget. In my actual code I have installed an event filter in the QDockWidget, to handle resize operations, and in the QPlainTextEdit, to handle the double click…
hteso
  • 55
  • 2
  • 7
3
votes
1 answer

How to efficiently create a fixed width column logger using QPlaintTextEdit?

I want to create a log window in Qt (4.8) using QPlainTextEdit. This means I'll be using appendPlainText. That log needs to display columns of data which need to have a fixed width independently of the data shown (they will have the maximum size of…
Momergil
  • 2,213
  • 5
  • 29
  • 59
3
votes
1 answer

How to render QPlainTextEdit content to QPixmap with colors?

I was successfully using following code to render the content of a QTextEdit to QPixmap. But this fails for QPlainTextEdit. When I use QPlainTextEdit instead of QTextEdit, it rendered the content without any colors (all in black/white). QPixmap*…
Morpheus
  • 1,722
  • 5
  • 27
  • 38
3
votes
1 answer

How do I remove the space between QPlainTextEdit and its contents?

I'm using C++ and Qt on Windows to create a simple application which outputs some data to the screen using a QPlainTextEdit. The problem is that there is a small internal margin between the QPlainTextEdit's border and the text as shown here: The…
YmFzZTY0
  • 109
  • 1
  • 9
3
votes
0 answers

Qt how to move selection to one line up

I have a trouble. Here my code is: void TextEditor::moveToLineUp() { QTextCursor cur = textCursor(); if(cur.hasSelection()) { int start = cur.selectionStart(); int end = cur.selectionEnd(); QTextBlock startBlock =…
Vourhey
  • 49
  • 6
3
votes
1 answer

QTextEdit shift-tab wrong behaviour

shift+tab behaves as tab in QTextEdit/QPlainTextEdit. Looks like a common problem with no good solution. Is there any "classical" way to enable this functionality when tab increases indentation level and shift-tab decreases it?
samdavydov
  • 564
  • 3
  • 22
2
votes
1 answer

Get pointer to QTextBlock in QPlainTextEdit

I want to map two pointers in a QMap Object to store their relation. The key pointer points to a QTextBlock while the value pointer points to a widget. The aim is to update the position of the widget in relation to the position of the QTextBlock in…
Ben
  • 807
  • 1
  • 8
  • 22
2
votes
1 answer

PyQt QPlainTextEdit "Command + Backpace" doesn't delete the line on MacOS

Pressing Command + Backspace on MacOs normally deletes the current line. Is it possible to reproduce this behaviour in QPlainTextEdit? It works as expected with QLineEdit. Here's a minimal example to reproduce the issue: from PyQt5.QtWidgets import…
2
votes
1 answer

Python PyQt5 - Selecting inserted cursor text?

I have a QPlainTextEdit widget, and am trying get the cursor to automatically select the inserted text. My current methodology is to select backwards using QTextCursor.WordLeft because using .insertText() moves the cursor to the end of that word.…
braedynl
  • 31
  • 7
1
2
3
9 10