[Qt controls QLineEdit, QPlainTextEdit, QTextEdit, QTextBrowser] usage and differences

Introduction QLineEdit, QPlainTextEdit, QTextEdit and QTextBrowser are all controls used for text input and display in Qt. There are some differences between them and they are suitable for different scenarios. The following is a brief introduction, differences and usage tips for these four categories: Function Name Function QLineEdit QLineEdit is a simple single-line text input […]

python pyqt5 QTextEdit 2. Automatic completion of prompt words in text editing box, using QCompleter

1. Enter at least 2 characters to start the prompt, and press Enter to complete it automatically. 2. Not case sensitive 3. Use substitution to prevent completion case inconsistencies. renderings Code: 1. Rewrite QTextEdit and create TextEdit.py from PyQt5.QtCore import Qt, QStringListModel from PyQt5.QtGui import QTextCursor from PyQt5.QtWidgets import QTextEdit, QCompleter class TextEdit(QTextEdit): def __init__(self, […]

Qt5.14 package QTextEdit can display line and column numbers

Overview Development operating system: win11 Qt version: 5.14 The original intention of encapsulation is used to display the source code data received by the network and serial port. It is displayed in hexadecimal and each frame displays one line. function Can display row and column numbers Number of columns and rows can be specified Show […]

The QFile class in Qt reads ansi-encoded txt files and displays garbled characters in the QTextEdit control

Series article directory Article directory Series Article Directory foreword 1. Still unable to solve the garbled problem Two, the solution 1. Method 1: Use the fromLocal8Bit() function of QString 2. Read the file in utf-8 encoding format Summarize Foreword Use the QFile class in Qt to read text files in ANSI encoding format, and display […]

QTextEdit, QPlainTextEdit multi-line input box

QTextEdit, QPlainTextEdit multi-line input box QTextEdit and QPlainTextEdit are multi-line text input box components in PyQt6. This tutorial will introduce how to add QTextEdit and QPlainTextEdit multi-line text input boxes to the PyQt6 window, and implement basic applications such as modifying styles and reading input text. Quick tour: Differences between QTextEdit and QPlainTextEdit Add QTextEdit, […]