From 59b2dae0682c91c2c3148428858564ac547a7cb9 Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 02:54:51 +0900 Subject: [PATCH 1/9] I fix the code for version 1.5.1 release --- ExcelViewer/mainwindow.cpp | 3 --- QXlsx/CMakeLists.txt | 2 +- QXlsx/QXlsx.pri | 13 +++++++++++-- QXlsx/QXlsx.pro | 6 ------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ExcelViewer/mainwindow.cpp b/ExcelViewer/mainwindow.cpp index 79601bbd..c58f7f81 100644 --- a/ExcelViewer/mainwindow.cpp +++ b/ExcelViewer/mainwindow.cpp @@ -16,9 +16,6 @@ using namespace QXlsx; -// Hard-coded QXlsx version string (based on the library you are using) -// static const char *QXLSX_VERSION = "1.5.0"; - MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt index 653ce416..64c0defd 100644 --- a/QXlsx/CMakeLists.txt +++ b/QXlsx/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16) project(QXlsx - VERSION 1.5.0 + VERSION 1.5.1 LANGUAGES CXX ) diff --git a/QXlsx/QXlsx.pri b/QXlsx/QXlsx.pri index 7459852b..03fd11f8 100644 --- a/QXlsx/QXlsx.pri +++ b/QXlsx/QXlsx.pri @@ -5,8 +5,17 @@ QT += core QT += gui-private -# TODO: Define your C++ version. c++14, c++17, etc. -CONFIG += c++11 +# Define your C++ version. +# Safe method using built-in variables without brackets +lessThan(QT_MAJOR_VERSION, 6) { + # Set C++11 for Qt 5 (5.7 or higher version) + CONFIG += c++11 + message("Qt 5 detected: Setting C++ standard to C++11") +} else { + # Set C++17 for Qt 6 + CONFIG += c++17 + message("Qt 6 detected: Setting C++ standard to C++17") +} # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings diff --git a/QXlsx/QXlsx.pro b/QXlsx/QXlsx.pro index 5cc35757..c4946b80 100644 --- a/QXlsx/QXlsx.pro +++ b/QXlsx/QXlsx.pro @@ -29,10 +29,4 @@ QXLSX_HEADERPATH=$$PWD/header/ QXLSX_SOURCEPATH=$$PWD/source/ include($$PWD/QXlsx.pri) -HEADERS += \ - header/xlsxreadsax.h - -SOURCES += \ - source/xlsxreadsax.cpp - From aaf791ec22c264876ec36ea9d5ee1fcaa3cd412a Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 03:16:59 +0900 Subject: [PATCH 2/9] Update CMakeLists.txt - Disable strict MSVC compliance mode to prevent build errors caused by standard library ('stdext') changes in newer MSVC compilers with older Qt headers. --- QXlsx/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt index 64c0defd..f527965d 100644 --- a/QXlsx/CMakeLists.txt +++ b/QXlsx/CMakeLists.txt @@ -158,6 +158,12 @@ target_compile_definitions(QXlsx PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060600 ) +if(MSVC) + # Disable strict MSVC compliance mode to prevent build errors + # caused by standard library ('stdext') changes in newer MSVC compilers with older Qt headers. + target_compile_options(QXlsx PRIVATE /permissive) +endif() + if (NOT WIN32) # Strict iterators can't be used on Windows, they lead to a link error # when application code iterates over a QVector for instance, unless From 2633e3d8100d6a53def1224749f731e5e5bfe463 Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 03:28:15 +0900 Subject: [PATCH 3/9] Update MSVC compile options for QXlsx Replace MSVC compliance mode disabling with a definition to allow compiler and STL version mismatch. --- QXlsx/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt index f527965d..e7187ae5 100644 --- a/QXlsx/CMakeLists.txt +++ b/QXlsx/CMakeLists.txt @@ -159,9 +159,8 @@ target_compile_definitions(QXlsx PRIVATE ) if(MSVC) - # Disable strict MSVC compliance mode to prevent build errors - # caused by standard library ('stdext') changes in newer MSVC compilers with older Qt headers. - target_compile_options(QXlsx PRIVATE /permissive) + # Fix 'stdext' errors by allowing mismatch between newer MSVC toolset and older Qt/STL headers + target_compile_definitions(QXlsx PRIVATE _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) endif() if (NOT WIN32) From 22bc9687d5a9a4b841b1868ef41e06b4e97ea4ee Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 03:36:18 +0900 Subject: [PATCH 4/9] Adjust MSVC compiler options in CMakeLists.txt Updated CMakeLists.txt to modify compiler options for MSVC. --- QXlsx/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt index e7187ae5..a1a9754f 100644 --- a/QXlsx/CMakeLists.txt +++ b/QXlsx/CMakeLists.txt @@ -158,11 +158,14 @@ target_compile_definitions(QXlsx PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060600 ) + if(MSVC) - # Fix 'stdext' errors by allowing mismatch between newer MSVC toolset and older Qt/STL headers - target_compile_definitions(QXlsx PRIVATE _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) + # SHELL: forces CMake to place /permissive at the very end of the argument list, + # overriding any automatically appended /permissive- flags. + target_compile_options(QXlsx PRIVATE "SHELL:/permissive") endif() + if (NOT WIN32) # Strict iterators can't be used on Windows, they lead to a link error # when application code iterates over a QVector for instance, unless From eda640a7aae8056b833302f4efbe5284c4c6f11c Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 03:45:01 +0900 Subject: [PATCH 5/9] Modify CMakeLists.txt for MSVC compiler flags --- QXlsx/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt index a1a9754f..7c96ea23 100644 --- a/QXlsx/CMakeLists.txt +++ b/QXlsx/CMakeLists.txt @@ -7,6 +7,12 @@ project(QXlsx LANGUAGES CXX ) +if(MSVC) + string(REPLACE "/permissive-" "/permissive" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/permissive-" "/permissive" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/permissive-" "/permissive" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") +endif() + set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) From 5c9fff4b98e93ca85d7d7601976a151aa6bfb161 Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 03:54:21 +0900 Subject: [PATCH 6/9] Remove MSVC permissive flag handling Removed MSVC specific flags for permissive mode. --- QXlsx/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt index 7c96ea23..a1a9754f 100644 --- a/QXlsx/CMakeLists.txt +++ b/QXlsx/CMakeLists.txt @@ -7,12 +7,6 @@ project(QXlsx LANGUAGES CXX ) -if(MSVC) - string(REPLACE "/permissive-" "/permissive" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "/permissive-" "/permissive" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/permissive-" "/permissive" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -endif() - set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) From 37574b4b9d99052816cc4d2e2a46eb27a103c830 Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 03:55:03 +0900 Subject: [PATCH 7/9] Add stdext definition for MSVC compatibility --- QXlsx/header/xlsxglobal.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/QXlsx/header/xlsxglobal.h b/QXlsx/header/xlsxglobal.h index 91756173..0b3a173e 100644 --- a/QXlsx/header/xlsxglobal.h +++ b/QXlsx/header/xlsxglobal.h @@ -3,6 +3,10 @@ #ifndef XLSXGLOBAL_H #define XLSXGLOBAL_H +#if defined(_MSC_VER) && !defined(stdext) +#define stdext ::std +#endif + #include #include #include From 3fcf8225d0f2d4a8c577a64e9e2d681a4bf18e19 Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 03:59:35 +0900 Subject: [PATCH 8/9] Add make_checked_array_iterator for MSVC compatibility --- QXlsx/header/xlsxglobal.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/QXlsx/header/xlsxglobal.h b/QXlsx/header/xlsxglobal.h index 0b3a173e..2994de03 100644 --- a/QXlsx/header/xlsxglobal.h +++ b/QXlsx/header/xlsxglobal.h @@ -3,8 +3,14 @@ #ifndef XLSXGLOBAL_H #define XLSXGLOBAL_H -#if defined(_MSC_VER) && !defined(stdext) -#define stdext ::std +#if defined(_MSC_VER) +#include +namespace std { + template + inline _Iter make_checked_array_iterator(_Iter _Array, size_t _Size, size_t _Start = 0) { + return _Array + _Start; + } +} #endif #include From 5aedfb8688c1904352c0fe07446d3ed5f14ea568 Mon Sep 17 00:00:00 2001 From: Jay Two Date: Wed, 17 Jun 2026 04:06:24 +0900 Subject: [PATCH 9/9] Adjust include guards and namespace for iterator --- QXlsx/header/xlsxglobal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/QXlsx/header/xlsxglobal.h b/QXlsx/header/xlsxglobal.h index 2994de03..fc56f3d9 100644 --- a/QXlsx/header/xlsxglobal.h +++ b/QXlsx/header/xlsxglobal.h @@ -4,7 +4,10 @@ #define XLSXGLOBAL_H #if defined(_MSC_VER) -#include +# ifndef stdext +# define stdext ::std +# endif +# include namespace std { template inline _Iter make_checked_array_iterator(_Iter _Array, size_t _Size, size_t _Start = 0) {