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..a1a9754f 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 ) @@ -158,6 +158,14 @@ target_compile_definitions(QXlsx PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060600 ) + +if(MSVC) + # 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 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 - diff --git a/QXlsx/header/xlsxglobal.h b/QXlsx/header/xlsxglobal.h index 91756173..fc56f3d9 100644 --- a/QXlsx/header/xlsxglobal.h +++ b/QXlsx/header/xlsxglobal.h @@ -3,6 +3,19 @@ #ifndef XLSXGLOBAL_H #define XLSXGLOBAL_H +#if defined(_MSC_VER) +# 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) { + return _Array + _Start; + } +} +#endif + #include #include #include