https://github.com/andreicherniaev/qbuffer_test
QBuffer test
https://github.com/andreicherniaev/qbuffer_test
example qt
Last synced: 11 months ago
JSON representation
QBuffer test
- Host: GitHub
- URL: https://github.com/andreicherniaev/qbuffer_test
- Owner: AndreiCherniaev
- License: apache-2.0
- Created: 2024-11-20T01:07:01.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-29T06:16:18.000Z (about 1 year ago)
- Last Synced: 2025-03-16T06:43:09.387Z (11 months ago)
- Topics: example, qt
- Language: C++
- Homepage: https://forum.qt.io/topic/159810/qbuffer-buffer-clear-doesn-t-affect-to-size/2
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About
Qt example how to use QBuffer.
## Compiling
```
git clone https://github.com/AndreiCherniaev/QBuffer_test.git && cd QBuffer_test
mkdir build/
cmake -S src/ -B build/ --fresh # qt-cmake -S src/ -B build/ -DCMAKE_BUILD_TYPE=Release --fresh
cmake --build build/ --parallel
```
## Run
Before start open source code and uncomment A) and comment B),C) and rebuild
### A) Open-close way
```
buf.close();
buf.open(QBuffer::WriteOnly);
```
Log
```
Writer;size;1;1;B;isNull;false;buf_cnt;1
myflush;size;1;1;B;isNull;false
myflush;size;1;1;B;isNull;false
Writer;size;1;1;B;isNull;false;buf_cnt;1
~;size;1;1;B;isNull;false;buf_cnt;1
```
## B) Clear way
Then open source code and comment A),C) and uncomment B) and rebuild
```
buf.buffer().clear();
```
Log
```
Writer;size;1;1;B;isNull;false;buf_cnt;1
myflush;size;1;1;B;isNull;false
myflush;size;0;0;B;isNull;true
Writer;size;2;2;B;isNull;false;buf_cnt;1
~;size;2;2;B;isNull;false;buf_cnt;1
```
## C) Seek way
Then open source code and comment A),B) and uncomment C) and rebuild
```
buf.seek(0L);
```
Log
```
Writer;size;1;1;B;isNull;false;buf_cnt;1
myflush;size;1;1;B;isNull;false
myflush;size;1;1;B;isNull;false
Writer;size;1;1;B;isNull;false;buf_cnt;1
~;size;1;1;B;isNull;false;buf_cnt;1
```