diff --git a/ExCRLF/CMakeLists.txt b/ExCRLF/CMakeLists.txt new file mode 100644 index 0000000..98b152b --- /dev/null +++ b/ExCRLF/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.14) + +project(ExCRLF LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) + +add_executable(ExCRLF + main.cpp +) +target_link_libraries(ExCRLF Qt${QT_VERSION_MAJOR}::Core) diff --git a/ExCRLF/bin/ExCRLF.txt b/ExCRLF/bin/ExCRLF.txt new file mode 100644 index 0000000..6faaae0 --- /dev/null +++ b/ExCRLF/bin/ExCRLF.txt @@ -0,0 +1,4 @@ +(abcdefg1234hijk) [FOXES](abcdefg1234hijk) +[FOXES](abcdefg1234hijk) +[FOXES](abcdefg1234hijk) + [FOXES] \ No newline at end of file diff --git a/ExCRLF/main.cpp b/ExCRLF/main.cpp new file mode 100644 index 0000000..21df01a --- /dev/null +++ b/ExCRLF/main.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include +using namespace std; + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + +// QString s1 = "(abcdefg1234hijk)"; +// QString s2 = "[FOXES]"; + + QString s1 = "(abcdefg1234hijk)\r[FOXES]"; + QString s2 = "(abcdefg1234hijk)\n[FOXES]"; + QString s3 = "(abcdefg1234hijk)\r\n[FOXES]"; + QString s4 = "(abcdefg1234hijk)\n\r[FOXES]"; + + qDebug()<< "---------qDebug()----------"; + qDebug()<< s1; + qDebug().noquote()<< s1; + qDebug()<< s2; + qDebug().noquote()<< s2; + qDebug()<< s3; + qDebug().noquote()<< s3; + qDebug()<< s4; + qDebug().noquote()<< s4; + + qDebug()<< "---------cout----------"; + cout << "(abcdefg1234hijk)\r[FOXES]"; + cout.flush(); + cout << "(abcdefg1234hijk)\n[FOXES]"; + cout.flush(); + cout << "(abcdefg1234hijk)\r\n[FOXES]"; + cout.flush(); + cout << "(abcdefg1234hijk)\n\r[FOXES]"; + cout.flush(); + + QFile file("ExCRLF.txt"); + file.open(QIODevice::WriteOnly | QIODevice::Text); + file.write("(abcdefg1234hijk)\r[FOXES]"); + file.write("(abcdefg1234hijk)\n[FOXES]"); + file.write("(abcdefg1234hijk)\r\n[FOXES]"); + file.write("(abcdefg1234hijk)\n\r[FOXES]"); + file.close(); + + + + + return a.exec(); +} diff --git a/README.md b/README.md index 7ec6db8..30bfffd 100644 --- a/README.md +++ b/README.md @@ -148,10 +148,11 @@ - [乱码原因(Qt版本)_附上语文的pdf版本](https://blog.csdn.net/qq_33154343/article/details/79039644) - [qt中文乱码问题](https://blog.csdn.net/qq_33154343/article/details/78686103) - [借Qt中文乱码谈谈Coding中的编码问题](https://blog.csdn.net/qq_33154343/article/details/78686075) +- [一个微软自带的 notepad 所导致的问题](https://xmuli.blog.csdn.net/article/details/123508220) [★]
-- [Qt4和Qt5的信号和槽的使用差异](https://xmuli.blog.csdn.net/article/details/118346008) +- [Qt4和Qt5的信号和槽的使用差异](https://xmuli.blog.csdn.net/article/details/118346008) - `qt`中 Lambda 表达式