In Qt, QFile, QByteArray, QDataStream and QTextStream are commonly used file and data processing classes. Main functions and differences QFile: QFile is an I/O device used to read and write text and binary files and resources. You can use QFile on its own, or more conveniently with QTextStream or QDataStream. The file name is usually […]
Tag: qfile
Qt file directory operations QDir, QFile, QTemporaryDir/File, QTextStream, QDataStream, QSettings, QFileInfo, QFileSystemWatch
Abstract: This Qt blog post mainly introduces which classes can be used when processing file directory operations in Qt development, what are the functions of these classes, how to use them roughly, common class methods of classes and related matters that need to be paid attention to. Wait, for more details, you need to search […]
QFileSystemModel class and QStringListModel class
Introduction to QFileSystemModel QFileSystemModel is a model class in the Qt framework used to represent the directory structure of the local file system in Qt applications. It provides a convenient way to access and manipulate files and directories in the file system. The following is a detailed introduction to QFileSystemModel: Representation of directory structure: QFileSystemModel […]
Qt model view framework: QAbstractItemDelegate, QFileSystemModel
QAbstractItemDelegate 1. Description QAbstractItemDelegate provides an interface and common functionality for delegation in the model/view framework. The delegate displays individual items in the view and handles editing of model data. To render items in a custom way, you must implement paint() and sizeHint(). The QStyledItemDelegate class provides default implementations for these functions, if you don’t […]
Qt: Qfile and QTextStream read and write text files + Qt QFile /readLine() (*****)
Table of contents Qt: Qfile and QTextStream read and write text files (*****) Qt QFile reads and writes data by row (*****) [C + +] Qt text operation (read and write by line) (***) lines.push_back(line); //store each line in the vector in turn Official manual: readLine() ———————————- Reference: Qt: Qfile and QTextStream read and write […]
How to use the custom model to implement the file system model of QT intractable diseases? Similar to QFileSystemModel, but better than QFileSystemModel
Introduction This article discusses the shortcomings of the QT file system model QFileSystemModel, and discusses the improvement goals, how to implement a custom file system model, and the room for further improvement. Table of contents Inadequacies of QFileSystemModel Improvement goals Custom file system model room for further improvement text The shortcomings of QFileSystemModel In the […]
98-Data reading and writing and file management-data reading and writing basic class-file QFile
File QFile QFile inherits from QIODevice and will inherit the methods of QIODevice, QFile can read and write text files and binary files, and can be used alone or together with QTextStream and QDataStream. The method of creating an instance object with the QFile class is as follows, where parent is an instance inherited from […]
100-Data reading and writing and file management-Basic classes for data reading and writing-File information QFileInfo
File information QFileInfo File information QFileInfo is used to query file information, such as the relative path of the file, the absolute path, the file size, the file permission, the creation and modification time of the file, etc. The method of creating a file information object with the QFileInfo class is as follows, where str […]
How to use QFile in QT to identify the encoding format of txt files: utf-8 ANSI
Series article directory Article directory Series Article Directory foreword 1. Determine the encoding format of the txt file Two, the solution Specific use 3. Reference Foreword Brother, I read the txt file in ansi encoding format in the QFile class in the previous Qt, and displayed garbled characters in the QTextEdit control The article talks […]
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 […]